Visitar URL original
JUnit Jupiter best practices (#427) · apache/maven-resources-plugin@ef79973 · GitHub
Skip to content

Commit ef79973

Browse files
JUnit Jupiter best practices (#427)
Co-authored-by: Moderne <team@moderne.io>
1 parent 0949752 commit ef79973

5 files changed

Lines changed: 29 additions & 29 deletions

File tree

‎src/test/java/org/apache/maven/plugins/resources/BasicPropertyUtilsTest.java‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
import static org.junit.jupiter.api.Assertions.assertTrue;
3434

3535
@MojoTest
36-
public class BasicPropertyUtilsTest extends AbstractPropertyUtilsTest {
36+
class BasicPropertyUtilsTest extends AbstractPropertyUtilsTest {
3737
protected static final String VALIDATION_FILE_NAME =
3838
"target/test-classes/unit/propertiesutils-test/basic_validation.properties";
3939

@@ -65,7 +65,7 @@ protected Path getValidationFile() {
6565
* @throws Exception
6666
*/
6767
@Test
68-
public void testBasicLoadPropertyFF() throws Exception {
68+
void basicLoadPropertyFF() throws Exception {
6969
Properties prop = PropertyUtils.loadPropertyFile(propertyFile, false, false);
7070

7171
assertNotNull(prop);
@@ -78,7 +78,7 @@ public void testBasicLoadPropertyFF() throws Exception {
7878
* @throws Exception
7979
*/
8080
@Test
81-
public void testBasicLoadPropertyTF() throws Exception {
81+
void basicLoadPropertyTF() throws Exception {
8282
Properties prop = PropertyUtils.loadPropertyFile(propertyFile, true, false);
8383

8484
assertNotNull(prop);
@@ -91,7 +91,7 @@ public void testBasicLoadPropertyTF() throws Exception {
9191
* @throws Exception
9292
*/
9393
@Test
94-
public void testBasicLoadPropertyTT() throws Exception {
94+
void basicLoadPropertyTT() throws Exception {
9595
Properties prop = PropertyUtils.loadPropertyFile(propertyFile, true, true);
9696

9797
validationProp.putAll(System.getProperties());
@@ -105,7 +105,7 @@ public void testBasicLoadPropertyTT() throws Exception {
105105
* @throws Exception
106106
*/
107107
@Test
108-
public void testNonExistentProperty() throws Exception {
108+
void nonExistentProperty() throws Exception {
109109
Properties prop = PropertyUtils.loadPropertyFile(propertyFile, true, true);
110110

111111
validationProp.putAll(System.getProperties());

‎src/test/java/org/apache/maven/plugins/resources/CopyResourcesMojoTest.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@
4444
* @version $Id$
4545
*/
4646
@MojoTest
47-
public class CopyResourcesMojoTest {
47+
class CopyResourcesMojoTest {
4848

4949
@Test
5050
@InjectMojo(goal = "resources", pom = "classpath:/unit/resources-test/plugin-config.xml")
5151
@Basedir
52-
public void testCopyWithoutFiltering(ResourcesMojo mojo) throws Exception {
52+
void copyWithoutFiltering(ResourcesMojo mojo) throws Exception {
5353
Resource resource = new Resource();
5454
resource.setDirectory(getPluginBasedir() + "/src/test/unit-files/copy-resources-test/no-filter");
5555
resource.setFiltering(false);

‎src/test/java/org/apache/maven/plugins/resources/PropertyUtilsExceptionTest.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@
2626

2727
import static org.junit.jupiter.api.Assertions.assertThrows;
2828

29-
public class PropertyUtilsExceptionTest {
29+
class PropertyUtilsExceptionTest {
3030

3131
/**
3232
* load property test case can be adjusted by modifying the basic.properties and basic_validation properties
3333
*/
3434
@Test
35-
public void loadPropertyFileShouldFailWithFileNotFoundException() {
35+
void loadPropertyFileShouldFailWithFileNotFoundException() {
3636
assertThrows(
3737
FileNotFoundException.class,
3838
() -> PropertyUtils.loadPropertyFile(Paths.get("NON_EXISTENT_FILE"), true, true));

‎src/test/java/org/apache/maven/plugins/resources/ResourcesMojoTest.java‎

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
import static org.junit.jupiter.api.Assertions.assertTrue;
5050

5151
@MojoTest
52-
public class ResourcesMojoTest {
52+
class ResourcesMojoTest {
5353

5454
private static final String CONFIG_XML = "classpath:/unit/resources-test/plugin-config.xml";
5555

@@ -59,7 +59,7 @@ public class ResourcesMojoTest {
5959
@Test
6060
@InjectMojo(goal = "resources", pom = CONFIG_XML)
6161
@Basedir
62-
public void testHarnessEnvironment(ResourcesMojo mojo) {
62+
void harnessEnvironment(ResourcesMojo mojo) {
6363
assertNotNull(mojo);
6464
}
6565

@@ -68,7 +68,7 @@ public void testHarnessEnvironment(ResourcesMojo mojo) {
6868
@Test
6969
@InjectMojo(goal = "resources", pom = CONFIG_XML)
7070
@Basedir
71-
public void testResourceDirectoryStructure(ResourcesMojo mojo) throws Exception {
71+
void resourceDirectoryStructure(ResourcesMojo mojo) throws Exception {
7272
assertNotNull(mojo);
7373

7474
MavenProjectResourcesStub project = (MavenProjectResourcesStub) mojo.project;
@@ -101,7 +101,7 @@ public void testResourceDirectoryStructure(ResourcesMojo mojo) throws Exception
101101
@Test
102102
@InjectMojo(goal = "resources", pom = CONFIG_XML)
103103
@Basedir
104-
public void testResourceDirectoryStructureRelativePath(ResourcesMojo mojo) throws Exception {
104+
void resourceDirectoryStructureRelativePath(ResourcesMojo mojo) throws Exception {
105105
assertNotNull(mojo);
106106

107107
MavenProjectResourcesStub project = (MavenProjectResourcesStub) mojo.project;
@@ -135,7 +135,7 @@ public void testResourceDirectoryStructureRelativePath(ResourcesMojo mojo) throw
135135
@Test
136136
@InjectMojo(goal = "resources", pom = CONFIG_XML)
137137
@Basedir
138-
public void testResourceEncoding(ResourcesMojo mojo) throws Exception {
138+
void resourceEncoding(ResourcesMojo mojo) throws Exception {
139139
assertNotNull(mojo);
140140

141141
MavenProjectResourcesStub project = (MavenProjectResourcesStub) mojo.project;
@@ -162,7 +162,7 @@ public void testResourceEncoding(ResourcesMojo mojo) throws Exception {
162162
@Test
163163
@InjectMojo(goal = "resources", pom = CONFIG_XML)
164164
@Basedir
165-
public void testResourceInclude(ResourcesMojo mojo) throws Exception {
165+
void resourceInclude(ResourcesMojo mojo) throws Exception {
166166
assertNotNull(mojo);
167167

168168
MavenProjectResourcesStub project = (MavenProjectResourcesStub) mojo.project;
@@ -211,7 +211,7 @@ public void testResourceInclude(ResourcesMojo mojo) throws Exception {
211211
@Test
212212
@InjectMojo(goal = "resources", pom = CONFIG_XML)
213213
@Basedir
214-
public void testResourceExclude(ResourcesMojo mojo) throws Exception {
214+
void resourceExclude(ResourcesMojo mojo) throws Exception {
215215
assertNotNull(mojo);
216216

217217
MavenProjectResourcesStub project = (MavenProjectResourcesStub) mojo.project;
@@ -261,7 +261,7 @@ public void testResourceExclude(ResourcesMojo mojo) throws Exception {
261261
@Test
262262
@InjectMojo(goal = "resources", pom = CONFIG_XML)
263263
@Basedir
264-
public void testResourceTargetPath(ResourcesMojo mojo) throws Exception {
264+
void resourceTargetPath(ResourcesMojo mojo) throws Exception {
265265
assertNotNull(mojo);
266266

267267
MavenProjectResourcesStub project = (MavenProjectResourcesStub) mojo.project;
@@ -296,7 +296,7 @@ public void testResourceTargetPath(ResourcesMojo mojo) throws Exception {
296296
@Test
297297
@InjectMojo(goal = "resources", pom = CONFIG_XML)
298298
@Basedir
299-
public void testResourceSystemPropertiesFiltering(ResourcesMojo mojo) throws Exception {
299+
void resourceSystemPropertiesFiltering(ResourcesMojo mojo) throws Exception {
300300
assertNotNull(mojo);
301301

302302
MavenProjectResourcesStub project = (MavenProjectResourcesStub) mojo.project;
@@ -337,7 +337,7 @@ public void testResourceSystemPropertiesFiltering(ResourcesMojo mojo) throws Exc
337337
@Test
338338
@InjectMojo(goal = "resources", pom = CONFIG_XML)
339339
@Basedir
340-
public void testResourceProjectPropertiesFiltering(ResourcesMojo mojo) throws Exception {
340+
void resourceProjectPropertiesFiltering(ResourcesMojo mojo) throws Exception {
341341
assertNotNull(mojo);
342342

343343
MavenProjectResourcesStub project = (MavenProjectResourcesStub) mojo.project;
@@ -366,7 +366,7 @@ public void testResourceProjectPropertiesFiltering(ResourcesMojo mojo) throws Ex
366366
@Test
367367
@InjectMojo(goal = "resources", pom = CONFIG_XML)
368368
@Basedir
369-
public void testProjectPropertyFilteringPropertyDestination(ResourcesMojo mojo) throws Exception {
369+
void projectPropertyFilteringPropertyDestination(ResourcesMojo mojo) throws Exception {
370370
assertNotNull(mojo);
371371

372372
MavenProjectResourcesStub project = (MavenProjectResourcesStub) mojo.project;
@@ -398,7 +398,7 @@ public void testProjectPropertyFilteringPropertyDestination(ResourcesMojo mojo)
398398
@Test
399399
@InjectMojo(goal = "resources", pom = CONFIG_XML)
400400
@Basedir
401-
public void testPropertyFilesFiltering(ResourcesMojo mojo) throws Exception {
401+
void propertyFilesFiltering(ResourcesMojo mojo) throws Exception {
402402
assertNotNull(mojo);
403403

404404
MavenProjectResourcesStub project = (MavenProjectResourcesStub) mojo.project;
@@ -430,7 +430,7 @@ public void testPropertyFilesFiltering(ResourcesMojo mojo) throws Exception {
430430
@Test
431431
@InjectMojo(goal = "resources", pom = CONFIG_XML)
432432
@Basedir
433-
public void testPropertyFilesExtra(ResourcesMojo mojo) throws Exception {
433+
void propertyFilesExtra(ResourcesMojo mojo) throws Exception {
434434
assertNotNull(mojo);
435435

436436
MavenProjectResourcesStub project = (MavenProjectResourcesStub) mojo.project;
@@ -462,7 +462,7 @@ public void testPropertyFilesExtra(ResourcesMojo mojo) throws Exception {
462462
@Test
463463
@InjectMojo(goal = "resources", pom = CONFIG_XML)
464464
@Basedir
465-
public void testPropertyFilesMainAndExtra(ResourcesMojo mojo) throws Exception {
465+
void propertyFilesMainAndExtra(ResourcesMojo mojo) throws Exception {
466466
assertNotNull(mojo);
467467

468468
MavenProjectResourcesStub project = (MavenProjectResourcesStub) mojo.project;
@@ -505,7 +505,7 @@ public void testPropertyFilesMainAndExtra(ResourcesMojo mojo) throws Exception {
505505
@Test
506506
@InjectMojo(goal = "resources", pom = CONFIG_XML)
507507
@Basedir
508-
public void testPropertyFilesFilteringTokensInFilters(ResourcesMojo mojo) throws Exception {
508+
void propertyFilesFilteringTokensInFilters(ResourcesMojo mojo) throws Exception {
509509
assertNotNull(mojo);
510510

511511
MavenProjectResourcesStub project = (MavenProjectResourcesStub) mojo.project;
@@ -536,7 +536,7 @@ public void testPropertyFilesFilteringTokensInFilters(ResourcesMojo mojo) throws
536536
@Test
537537
@InjectMojo(goal = "resources", pom = CONFIG_XML)
538538
@Basedir
539-
public void testWindowsPathEscapingDisabled(ResourcesMojo mojo) throws Exception {
539+
void windowsPathEscapingDisabled(ResourcesMojo mojo) throws Exception {
540540
assertNotNull(mojo);
541541

542542
MavenProjectResourcesStub project = (MavenProjectResourcesStub) mojo.project;
@@ -571,7 +571,7 @@ public void testWindowsPathEscapingDisabled(ResourcesMojo mojo) throws Exception
571571
@Test
572572
@InjectMojo(goal = "resources", pom = CONFIG_XML)
573573
@Basedir
574-
public void testWindowsPathEscapingEnabled(ResourcesMojo mojo) throws Exception {
574+
void windowsPathEscapingEnabled(ResourcesMojo mojo) throws Exception {
575575
assertNotNull(mojo);
576576

577577
MavenProjectResourcesStub project = (MavenProjectResourcesStub) mojo.project;

‎src/test/java/org/apache/maven/plugins/resources/TestResourcesTest.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
import static org.junit.jupiter.api.Assertions.assertTrue;
4242

4343
@MojoTest
44-
public class TestResourcesTest {
44+
class TestResourcesTest {
4545
private static final String CONFIG_XML = "classpath:/unit/resources-test/plugin-config.xml";
4646

4747
/**
@@ -50,7 +50,7 @@ public class TestResourcesTest {
5050
@Test
5151
@InjectMojo(goal = "testResources", pom = CONFIG_XML)
5252
@Basedir
53-
public void testHarnessEnvironment(TestResourcesMojo mojo) {
53+
void harnessEnvironment(TestResourcesMojo mojo) {
5454
assertNotNull(mojo);
5555
}
5656

@@ -59,7 +59,7 @@ public void testHarnessEnvironment(TestResourcesMojo mojo) {
5959
@Test
6060
@InjectMojo(goal = "testResources", pom = CONFIG_XML)
6161
@Basedir
62-
public void testTestResourceDirectoryCreation(TestResourcesMojo mojo) throws Exception {
62+
void testResourceDirectoryCreation(TestResourcesMojo mojo) throws Exception {
6363
assertNotNull(mojo);
6464

6565
MavenProjectResourcesStub project = (MavenProjectResourcesStub) mojo.project;

0 commit comments

Comments
 (0)