Skip to content

Commit

Permalink
[NO-JIRA] Refactor integration tests module (#576)
Browse files Browse the repository at this point in the history
* Remove test configuration that has been commented since 2015
* Remove unnecessary throws declarations
* Remove some unused declarations
* Remove commented code blocks that have not been touched for a long time
* Optimize imports
* Use proper junit assertions
  • Loading branch information
SimonBaars authored Dec 23, 2022
1 parent 4545bca commit 7815927
Show file tree
Hide file tree
Showing 48 changed files with 60 additions and 221 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ private static String trimEndComma( String pattern )

@Test
public void simpleNameTest()
throws Exception
{
prepare( "TestTwo" )
.executeTest()
Expand All @@ -113,7 +112,6 @@ public void simpleNameTest()

@Test
public void simpleNameTestAsParallel()
throws Exception
{
assumeThat( getSettings().getFramework(), anyOf( is( JUNIT47 ), is( TestNG ) ) );
prepare( "TestTwo" )
Expand All @@ -128,7 +126,6 @@ public void simpleNameTestAsParallel()

@Test
public void simpleNameTestWithJavaExt()
throws Exception
{
prepare( "TestTwo.java" )
.executeTest()
Expand All @@ -140,7 +137,6 @@ public void simpleNameTestWithJavaExt()

@Test
public void simpleNameTestWithWildcardPkg()
throws Exception
{
prepare( "**/TestTwo" )
.executeTest()
Expand All @@ -152,7 +148,6 @@ public void simpleNameTestWithWildcardPkg()

@Test
public void simpleNameTestWithJavaExtWildcardPkg()
throws Exception
{
prepare( "**/TestTwo.java" )
.executeTest()
Expand All @@ -164,7 +159,6 @@ public void simpleNameTestWithJavaExtWildcardPkg()

@Test
public void fullyQualifiedTest()
throws Exception
{
prepare( "jiras/surefire745/TestTwo.java" )
.executeTest()
Expand All @@ -176,7 +170,6 @@ public void fullyQualifiedTest()

@Test
public void shouldMatchSimpleClassNameAndMethod()
throws Exception
{
assumeThat( getSettings().getConfiguration(), is( TEST ) );
prepare( "BasicTest#testSuccessTwo" )
Expand Down Expand Up @@ -230,7 +223,6 @@ public void matchSimpleClassAndMethodWithJavaExtWildcardPkg()

@Test
public void shouldMatchWildcardPackageAndClassAndMethod()
throws Exception
{
assumeThat( getSettings().getConfiguration(), is( TEST ) );
prepare( "jiras/**/BasicTest#testSuccessTwo" )
Expand All @@ -242,7 +234,6 @@ public void shouldMatchWildcardPackageAndClassAndMethod()

@Test
public void regexClass()
throws Exception
{
prepare( "%regex[.*.TestTwo.*]" )
.executeTest()
Expand All @@ -254,7 +245,6 @@ public void regexClass()

@Test
public void testSuccessTwo()
throws Exception
{
assumeThat( getSettings().getConfiguration(), is( TEST ) );
prepare( "#testSuccessTwo" )
Expand All @@ -266,7 +256,6 @@ public void testSuccessTwo()

@Test
public void testRegexSuccessTwo()
throws Exception
{
assumeThat( getSettings().getConfiguration(), is( TEST ) );
prepare( "%regex[#testSuccessTwo]" )
Expand All @@ -277,7 +266,6 @@ public void testRegexSuccessTwo()

@Test
public void regexClassAndMethod()
throws Exception
{
assumeThat( getSettings().getConfiguration(), is( TEST ) );
prepare( "%regex[.*.BasicTest.*#testSuccessTwo]" )
Expand All @@ -289,7 +277,6 @@ public void regexClassAndMethod()

@Test
public void shouldMatchExactClassAndMethodWildcard()
throws Exception
{
assumeThat( getSettings().getConfiguration(), is( TEST ) );
prepare( "BasicTest#test*One" )
Expand All @@ -301,7 +288,6 @@ public void shouldMatchExactClassAndMethodWildcard()

@Test
public void shouldMatchExactClassAndMethodsWildcard()
throws Exception
{
assumeThat( getSettings().getConfiguration(), is( TEST ) );
prepare( "BasicTest#testSuccess*" )
Expand All @@ -314,7 +300,6 @@ public void shouldMatchExactClassAndMethodsWildcard()

@Test
public void shouldMatchExactClassAndMethodCharacters()
throws Exception
{
assumeThat( getSettings().getConfiguration(), is( TEST ) );
prepare( "BasicTest#test???????One" )
Expand All @@ -326,7 +311,6 @@ public void shouldMatchExactClassAndMethodCharacters()

@Test
public void shouldMatchExactClassAndMethodsPostfix()
throws Exception
{
assumeThat( getSettings().getConfiguration(), is( TEST ) );
prepare( "TestFive#testSuccess???" )
Expand All @@ -339,7 +323,6 @@ public void shouldMatchExactClassAndMethodsPostfix()

@Test
public void shouldMatchExactClassAndMethodPostfix()
throws Exception
{
assumeThat( getSettings().getConfiguration(), is( TEST ) );
prepare( "TestFive#testSuccess?????" )
Expand All @@ -351,7 +334,6 @@ public void shouldMatchExactClassAndMethodPostfix()

@Test
public void shouldMatchExactClassAndMultipleMethods()
throws Exception
{
assumeThat( getSettings().getConfiguration(), is( TEST ) );
prepare( "TestFive#testSuccessOne+testSuccessThree" )
Expand All @@ -364,7 +346,6 @@ public void shouldMatchExactClassAndMultipleMethods()

@Test
public void shouldMatchMultiplePatterns()
throws Exception
{
assumeThat( getSettings().getConfiguration(), is( TEST ) );
String test = "jiras/surefire745/BasicTest#testSuccessOne+testSuccessTwo" //2
Expand All @@ -381,7 +362,6 @@ public void shouldMatchMultiplePatterns()

@Test
public void shouldMatchMultiplePatternsAsParallel()
throws Exception
{
assumeThat( getSettings().getFramework(), anyOf( is( JUNIT47 ), is( TestNG ) ) );
assumeThat( getSettings().getConfiguration(), is( TEST ) );
Expand All @@ -401,7 +381,6 @@ public void shouldMatchMultiplePatternsAsParallel()

@Test
public void shouldMatchMultiplePatternsComplex()
throws Exception
{
assumeThat( getSettings().getConfiguration(), is( TEST ) );
String test = "**/BasicTest#testSuccessOne+testSuccessTwo" //2
Expand All @@ -418,7 +397,6 @@ public void shouldMatchMultiplePatternsComplex()

@Test
public void shouldMatchMultiplePatternsComplexAsParallel()
throws Exception
{
assumeThat( getSettings().getFramework(), anyOf( is( JUNIT47 ), is( TestNG ) ) );
assumeThat( getSettings().getConfiguration(), is( TEST ) );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.junit.Test;

import java.io.File;
import java.io.IOException;

import static org.assertj.core.api.Assertions.assertThat;

Expand All @@ -37,7 +38,7 @@ public class CheckTestNgCustomTestRunnerFactoryIT
{
@Test
public void testTestNgListenerReporter()
throws Exception
throws IOException
{
File baseDir = unpack()
.executeTest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public class CheckTestNgJdk14IT

@Test
public void testNgJdk14()
throws Exception
{
unpack( "/testng-jdk14" ).executeTest().verifyErrorFree( 1 );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public class CheckTestNgReportTestIT
{
@Test
public void testNgReport()
throws Exception
{
unpack( "/testng-simple" )
.sysProp( "testNgVersion", "5.7" )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,155 +45,125 @@ public class CheckTestNgVersionsIT
{

@Test public void test47()
throws Exception
{
runTestNgTest( "4.7", "jdk15" );
}

@Test
@Ignore( "5.0 and 5.0.1 jars on central are malformed SUREFIRE-375 + MAVENUPLOAD-1024" )
public void xXXtest50()
throws Exception
{
runTestNgTest( "5.0", "jdk15" );
}

@Test
@Ignore( "5.0 and 5.0.1 jars on central are malformed SUREFIRE-375 + MAVENUPLOAD-1024" )
public void xXXtest501()
throws Exception
{
runTestNgTest( "5.0.1", "jdk15" );
}

@Test public void test502()
throws Exception
{
runTestNgTest( "5.0.2", "jdk15" );
}

@Test public void test51()
throws Exception
{
runTestNgTest( "5.1", "jdk15" );
}

@Test public void test55()
throws Exception
{
runTestNgTest( "5.5", "jdk15" );
}

@Test public void test56()
throws Exception
{
runTestNgTest( "5.6", "jdk15" );
}

@Test public void test57()
throws Exception
{
runTestNgTest( "5.7", "jdk15" );
}

@Test public void test58()
throws Exception
{
runTestNgTest( "5.8", "jdk15" );
}

@Test public void test59()
throws Exception
{
runTestNgTest( "5.9", "jdk15" );
}

@Test public void test510()
throws Exception
{
runTestNgTest( "5.10", "jdk15" );
}

@Test public void test511()
throws Exception
{
runTestNgTest( "5.11", "jdk15" );
}

@Test public void test512()
throws Exception
{
runTestNgTest( "5.12.1" );
}

@Test public void test513()
throws Exception
{
runTestNgTest( "5.13" );
}

@Test public void test5131()
throws Exception
{
runTestNgTest( "5.13.1" );
}

@Test public void test514()
throws Exception
{
runTestNgTest( "5.14" );
}

@Test public void test5141()
throws Exception
{
runTestNgTest( "5.14.1" );
}

@Test public void test5142()
throws Exception
{
runTestNgTest( "5.14.2" );
}

@Test public void test60()
throws Exception
{
runTestNgTest( "6.0" );
}

@Test public void test685()
throws Exception
{
runTestNgTestWithRunOrder( "6.8.5" );
}

private void runTestNgTestWithRunOrder( String version )
throws Exception
{
runTestNgTest( version, null, true );
}

private void runTestNgTest( String version )
throws Exception
{
runTestNgTest( version, null, false );
}

private void runTestNgTest( String version, boolean validateRunOrder )
throws Exception
{
runTestNgTest( version, null, validateRunOrder );
}

private void runTestNgTest( String version, String classifier )
throws Exception
{
runTestNgTest( version, classifier, false );
}

private void runTestNgTest( String version, String classifier, boolean validateRunOrder )
throws Exception
{
final SurefireLauncher launcher = unpack( "testng-simple" )
.sysProp( "testNgVersion", version );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public class ClasspathFilteringIT
{
@Test
public void additionalClasspath()
throws Exception
{
unpack( "classpath-filtering" ).debugLogging().executeTest().verifyErrorFree( 1 );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@ public static Iterable<Object[]> data()
args.add( new Object[] { "junit4-twoForks-ff3", "junit4", props( 2, 3, true ), 5, 0, 2, 0, true } );
args.add( new Object[] { "junit47-twoForks-ff3", "junit47", props( 2, 3, true ), 5, 0, 2, 0, true } );
args.add( new Object[] { "junit47-twoForks-ff3-tcp", "junit47", props( 2, 3, true ), 5, 0, 2, 0, false } );
/*args.add( new Object[] { "junit4-twoForks-ff1x","junit4", props( 2, 1, false ), 5, 0, 2, 3 } );
args.add( new Object[] { "junit47-twoForks-ff1x","junit47",props( 2, 1, false ), 5, 0, 2, 3 } );
args.add( new Object[] { "junit4-twoForks-ff2x","junit4", props( 2, 2, false ), 5, 0, 2, 2 } );
args.add( new Object[] { "junit47-twoForks-ff2x","junit47",props( 2, 2, false ), 5, 0, 2, 2 } );*/
return args;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ public static Iterable<Object[]> data()
args.add( new Object[] { "testng-oneFork-ff3", null, props( 1, 3, true ), 5, 2, 0, 0, true } );
args.add( new Object[] { "testng-twoForks-ff3", null, props( 2, 3, true ), 5, 2, 0, 0, true } );
args.add( new Object[] { "testng-twoForks-ff3-tcp", null, props( 2, 3, true ), 5, 2, 0, 0, false } );
/*args.add( new Object[] { "testng-twoForks-ff1x", null, props( 2, 1, false ), 5, 2, 0, 3 } );
args.add( new Object[] { "testng-twoForks-ff2x", null, props( 2, 2, false ), 5, 2, 0, 2 } );*/
return args;
}

Expand Down
Loading

0 comments on commit 7815927

Please sign in to comment.