add migration cleanup from junit 4 to junit 5 #626
codacy.yml
on: pull_request
Codacy Security Scan
4m 53s
Annotations
10 errors and 10 warnings
JUnitMigrationCleanUpTest.testJUnitCleanupTwoFilesb:
sandbox_junit_cleanup_test/src/org/eclipse/jdt/ui/tests/quickfix/Java8/JUnitMigrationCleanUpTest.java#L992
expected: <package test;
import org.junit.jupiter.api.extension.AfterEachCallback;
import org.junit.jupiter.api.extension.BeforeEachCallback;
import org.junit.jupiter.api.extension.ExtensionContext;
/**
*
*/
public class MyExternalResource implements BeforeEachCallback, AfterEachCallback {
@OverRide
public void beforeEach(ExtensionContext context) {
int i=4;
}
@OverRide
public void afterEach(ExtensionContext context) {
}
public start(){
}
}
> but was: <package test;
import org.junit.rules.ExternalResource;
/**
*
*/
public class MyExternalResource extends ExternalResource {
@OverRide
protected void before() throws Throwable {
int i=4;
}
@OverRide
protected void after() {
}
public start(){
}
}
>
|
JUnitMigrationCleanUpTest.testJUnitCleanupParametrized(JUnitCleanupCases)[1] PositiveCase:
sandbox_junit_cleanup_test/src/org/eclipse/jdt/ui/tests/quickfix/Java8/JUnitMigrationCleanUpTest.java#L806
expected: <package test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.junit.MatcherAssume.assumeThat;
import static org.junit.jupiter.api.Assumptions.assumeTrue;
import org.hamcrest.CoreMatchers;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.platform.suite.api.SelectClasses;
import org.junit.platform.suite.api.Suite;
/**
*
*/
@suite
@SelectClasses({
MyTest.class
})
public class MyTest {
/**
* @throws java.lang.Exception
*/
@BeforeAll
public static void setUpBeforeClass() throws Exception {
}
/**
* @throws java.lang.Exception
*/
@afterall
public static void tearDownAfterClass() throws Exception {
}
/**
* @throws java.lang.Exception
*/
@beforeeach
public void setUp() throws Exception {
}
/**
* @throws java.lang.Exception
*/
@AfterEach
public void tearDown() throws Exception {
}
@disabled
@test
public void test() {
Assertions.fail("Not yet implemented");
Object o1,o2;
o1="foo";
o2=o1;
Assertions.assertSame(o1, o2, "ohno");
}
@disabled("not implemented")
@test
public void test2() {
Assertions.fail("Not yet implemented");
}
@test
public void test3() {
boolean condition=true;
Assumptions.assumeFalse(condition, "Bedingung nicht erfüllt");
Assumptions.assumeFalse(condition);
assumeTrue(condition, "Bedingung nicht erfüllt");
assumeTrue(condition);
Assertions.assertEquals("expected", "actual");
Assumptions.assumeNotNull(" ");
assumeThat(1, CoreMatchers.is(1));
assertThat(1, CoreMatchers.is(1));
}
@test
public void test4() {
Assertions.assertEquals("expected", "actual", "failuremessage");
int result=5;
Assertions.assertEquals(5, result); // expected = 5, actual = result
Assertions.assertNotEquals(5,result, "failuremessage"); // expected = 5, actual = result
Assertions.assertNotEquals(5, result); // expected = 5, actual = result
Assertions.assertTrue(false,"failuremessage");
Assertions.assertTrue(false);
Assertions.assertFalse(false,"failuremessage");
Assertions.assertFalse(false);
Assertions.assertNull(null, "failuremessage");
Assertions.assertNull(null);
}
}
> but was: <package test;
import org.junit.Assert;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.Assume;
import static org.junit.Assume.assumeTrue;
import org.hamcrest.CoreMatchers;
/**
*
*/
@RunWith(Suite.class)
@Suite.SuiteClasses({
MyTest.class
})
public class MyTest {
/**
* @throws java.lang.Exception
*/
@BeforeClass
public static void setUpBeforeClass() throws Exception {
}
/**
* @throws java.lang.Exception
*/
@afterclass
public static void tearDownAfterClass() throws Exception {
}
/**
* @throws java.lang.Exception
*/
@before
public void setUp() throws Exception {
}
/**
* @throws java.lang.Exception
*/
@after
public void tearDown() throws Exception {
}
@ignore
@test
public void test() {
Assert.fail("Not yet implemented");
Object o1,o2;
o1="foo";
o2=o1;
Assert.assertSame("ohno", o1, o2);
}
@ignore("not implemented")
@test
public void test2() {
Assert.fail("Not yet implemented");
}
@test
public void test3() {
boolean condition=true;
Assume.assumeFalse("Bedingung nicht erfüllt", condition);
Assume.assumeFalse(condition);
assumeTrue("Bedingung nicht erfüllt", condition);
assumeTrue(condition);
Assert.assertEquals("expected", "actual");
Assume.assumeNotNull(" ");
Assume.assumeThat(1, CoreMatchers.is(1));
Assert.assertThat(1, CoreMatchers.is(1));
}
@test
public void test4() {
Assert.assertEquals("failuremessage", "expected", "actual");
int result=5;
Assert.assertEquals(5, result); // expected = 5, actual = result
Assert.assertNotEquals("failuremessage",5, result); // expected = 5, actual = result
Assert.assertNotEquals(5, result); // expected = 5, actual = result
Assert.assertTrue("failuremessage",false);
Assert.assertTrue(false);
Assert.assertFalse("failuremessage",false);
Assert.assertFalse(false);
Assert.assertNull("failuremessage", null);
Assert.assertNull(null);
}
}
>
|
JUnitMigrationCleanUpTest.testJUnitCleanupParametrized(JUnitCleanupCases)[3] StaticImportCase:
sandbox_junit_cleanup_test/src/org/eclipse/jdt/ui/tests/quickfix/Java8/JUnitMigrationCleanUpTest.java#L806
expected: <package test;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.platform.suite.api.SelectClasses;
import org.junit.platform.suite.api.Suite;
/**
*
*/
@suite
@SelectClasses({
MyTest.class
})
public class MyTest {
/**
* @throws java.lang.Exception
*/
@BeforeAll
public static void setUpBeforeClass() throws Exception {
}
/**
* @throws java.lang.Exception
*/
@afterall
public static void tearDownAfterClass() throws Exception {
}
/**
* @throws java.lang.Exception
*/
@beforeeach
public void setUp() throws Exception {
}
/**
* @throws java.lang.Exception
*/
@AfterEach
public void tearDown() throws Exception {
}
@disabled
@test
public void test() {
fail("Not yet implemented");
}
@disabled("not implemented")
@test
public void test2() {
fail("Not yet implemented");
}
@test
public void test3() {
assertEquals("expected", "actual");
}
@test
public void test4() {
assertEquals("expected", "actual", "failuremessage");
int result=5;
assertEquals(5, result); // expected = 5, actual = result
assertNotEquals(5,result, "failuremessage"); // expected = 5, actual = result
assertTrue(false,"failuremessage");
assertFalse(false,"failuremessage");
assertTrue(false);
assertFalse(false);
}
}
> but was: <package test;
import static org.junit.Assert.*;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
/**
*
*/
@RunWith(Suite.class)
@Suite.SuiteClasses({
MyTest.class
})
public class MyTest {
/**
* @throws java.lang.Exception
*/
@BeforeClass
public static void setUpBeforeClass() throws Exception {
}
/**
* @throws java.lang.Exception
*/
@afterclass
public static void tearDownAfterClass() throws Exception {
}
/**
* @throws java.lang.Exception
*/
@before
public void setUp() throws Exception {
}
/**
* @throws java.lang.Exception
*/
@after
public void tearDown() throws Exception {
}
@ignore
@test
public void test() {
fail("Not yet implemented");
}
@ignore("not implemented")
@test
public void test2() {
fail("Not yet implemented");
}
@test
public void test3() {
assertEquals("expected", "actual");
}
@test
public void test4() {
assertEquals("failuremessage", "expected", "actual");
int result=5;
assertEquals(5, result); // expected = 5, actual = result
assertNotEquals("failuremessage",5, result); // expected = 5, actual = result
assertTrue("failuremessage",false);
assertFalse("failuremessage",false);
assertTrue(false);
assertFalse(false);
}
}
>
|
JUnitMigrationCleanUpTest.testJUnitCleanupParametrized(JUnitCleanupCases)[4] StaticExplicitImportCase:
sandbox_junit_cleanup_test/src/org/eclipse/jdt/ui/tests/quickfix/Java8/JUnitMigrationCleanUpTest.java#L806
expected: <package test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.platform.suite.api.SelectClasses;
import org.junit.platform.suite.api.Suite;
/**
*
*/
@suite
@SelectClasses({
MyTest.class
})
public class MyTest {
/**
* @throws java.lang.Exception
*/
@BeforeAll
public static void setUpBeforeClass() throws Exception {
}
/**
* @throws java.lang.Exception
*/
@afterall
public static void tearDownAfterClass() throws Exception {
}
/**
* @throws java.lang.Exception
*/
@beforeeach
public void setUp() throws Exception {
}
/**
* @throws java.lang.Exception
*/
@AfterEach
public void tearDown() throws Exception {
}
@disabled
@test
public void test() {
fail("Not yet implemented");
}
@disabled("not implemented")
@test
public void test2() {
fail("Not yet implemented");
}
@test
public void test3() {
assertEquals("expected", "actual");
}
@test
public void test4() {
assertEquals("expected", "actual", "failuremessage");
int result=5;
assertEquals(5, result); // expected = 5, actual = result
assertNotEquals(5,result, "failuremessage"); // expected = 5, actual = result
assertTrue(false,"failuremessage");
assertFalse(false,"failuremessage");
assertTrue(false);
assertFalse(false);
}
}
> but was: <package test;
import static org.junit.Assert.fail;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
/**
*
*/
@RunWith(Suite.class)
@Suite.SuiteClasses({
MyTest.class
})
public class MyTest {
/**
* @throws java.lang.Exception
*/
@BeforeClass
public static void setUpBeforeClass() throws Exception {
}
/**
* @throws java.lang.Exception
*/
@afterclass
public static void tearDownAfterClass() throws Exception {
}
/**
* @throws java.lang.Exception
*/
@before
public void setUp() throws Exception {
}
/**
* @throws java.lang.Exception
*/
@after
public void tearDown() throws Exception {
}
@ignore
@test
public void test() {
fail("Not yet implemented");
}
@ignore("not implemented")
@test
public void test2() {
fail("Not yet implemented");
}
@test
public void test3() {
assertEquals("expected", "actual");
}
@test
public void test4() {
assertEquals("failuremessage", "expected", "actual");
int result=5;
assertEquals(5, result); // expected = 5, actual = result
assertNotEquals("failuremessage",5, result); // expected = 5, actual = result
assertTrue("failuremessage",false);
assertFalse("failuremessage",false);
assertTrue(false);
assertFalse(false);
}
}
>
|
JUnitMigrationCleanUpTest.testJUnitCleanupParametrized(JUnitCleanupCases)[5] RuleAnonymousExternalResource:
sandbox_junit_cleanup_test/src/org/eclipse/jdt/ui/tests/quickfix/Java8/JUnitMigrationCleanUpTest.java#L806
expected: <package test;
import org.junit.Rule;
import org.junit.jupiter.api.Test;
import org.junit.rules.ExternalResource;
/**
*
*/
public class MyTest {
@rule
public ExternalResource er= new ExternalResource() {
@OverRide
protected void before() throws Throwable {
};
@OverRide
protected void after() {
};
};
@test
public void test3() {
}
}
> but was: <package test;
import org.junit.Test;
import org.junit.Rule;
import org.junit.rules.ExternalResource;
/**
*
*/
public class MyTest {
@rule
public ExternalResource er= new ExternalResource() {
@OverRide
protected void before() throws Throwable {
};
@OverRide
protected void after() {
};
};
@test
public void test3() {
}
}
>
|
JUnitMigrationCleanUpTest.testJUnitCleanupParametrized(JUnitCleanupCases)[6] RuleNestedExternalResource:
sandbox_junit_cleanup_test/src/org/eclipse/jdt/ui/tests/quickfix/Java8/JUnitMigrationCleanUpTest.java#L806
expected: <package test;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.AfterEachCallback;
import org.junit.jupiter.api.extension.BeforeEachCallback;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.api.extension.RegisterExtension;
/**
*
*/
public class MyTest {
final class MyExternalResource implements BeforeEachCallback, AfterEachCallback {
@OverRide
public void beforeEach(ExtensionContext context) {
super.beforeEach(context);
int i=4;
}
@OverRide
public void afterEach(ExtensionContext context) {
super.afterEach(context);
}
}
@RegisterExtension
public ExternalResource er= new MyExternalResource();
@test
public void test3() {
}
}
> but was: <package test;
import org.junit.Test;
import org.junit.Rule;
import org.junit.rules.ExternalResource;
/**
*
*/
public class MyTest {
final class MyExternalResource extends ExternalResource {
@OverRide
protected void before() throws Throwable {
super.before();
int i=4;
}
@OverRide
protected void after() {
super.after();
}
}
@rule
public ExternalResource er= new MyExternalResource();
@test
public void test3() {
}
}
>
|
JUnitMigrationCleanUpTest.testJUnitCleanupParametrized(JUnitCleanupCases)[7] TestnameRule:
sandbox_junit_cleanup_test/src/org/eclipse/jdt/ui/tests/quickfix/Java8/JUnitMigrationCleanUpTest.java#L806
expected: <package test;
import java.io.File;
import java.io.IOException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInfo;
import org.junit.jupiter.api.io.TempDir;
/**
*
*/
public class MyTest {
@tempdir
Path tempFolder;
private String testName;
@beforeeach
void init(TestInfo testInfo) {
this.testName = testInfo.getDisplayName();
}
private static final String SRC= "src";
@test
public void test3() throws IOException{
System.out.println("Test name: " + testName);
File newFile = tempFolder.resolve("myfile.txt").toFile();
}
}
> but was: <package test;
import java.io.File;
import java.io.IOException;
import org.junit.Test;
import org.junit.Rule;
import org.junit.rules.TestName;
import org.junit.rules.TemporaryFolder;
/**
*
*/
public class MyTest {
private static final String SRC= "src";
@rule
public TemporaryFolder tempFolder = new TemporaryFolder();
@rule
public TestName tn = new TestName();
@test
public void test3() throws IOException{
System.out.println("Test name: " + tn.getMethodName());
File newFile = tempFolder.newFile("myfile.txt");
}
}
>
|
JUnitMigrationCleanUpTest.testJUnitCleanupdonttouch(NOJUnitCleanupCases)[1] NOCase:
sandbox_junit_cleanup_test/src/org/eclipse/jdt/ui/tests/quickfix/Java8/JUnitMigrationCleanUpTest.java#L853
MyTest.java has compilation problems:
The import org cannot be resolved
The import org cannot be resolved
Test cannot be resolved to a type
The method assertEquals(String, String) is undefined for the type MyTest
|
JUnitMigrationCleanUpTest.testJUnitCleanupTwoFiles:
sandbox_junit_cleanup_test/src/org/eclipse/jdt/ui/tests/quickfix/Java8/JUnitMigrationCleanUpTest.java#L905
expected: <package test;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import test.MyExternalResource;
/**
*
*/
public class MyTest {
@RegisterExtension
public MyExternalResource er= new MyExternalResource();
@before
public void genericbefore(){
er.start();
}
@test
public void test3() {
}
}
package test;
import org.junit.jupiter.api.extension.AfterEachCallback;
import org.junit.jupiter.api.extension.BeforeEachCallback;
import org.junit.jupiter.api.extension.ExtensionContext;
/**
*
*/
public class MyExternalResource implements BeforeEachCallback, AfterEachCallback {
@OverRide
public void beforeEach(ExtensionContext context) {
int i=4;
}
@OverRide
public void afterEach(ExtensionContext context) {
}
public start(){
}
}
> but was: <package test;
import org.junit.Test;
import org.junit.Rule;
import test.MyExternalResource;
/**
*
*/
public class MyTest {
@rule
public MyExternalResource er= new MyExternalResource();
@before
public void genericbefore(){
er.start();
}
@test
public void test3() {
}
}
package test;
import org.junit.rules.ExternalResource;
/**
*
*/
public class MyExternalResource extends ExternalResource {
@OverRide
protected void before() throws Throwable {
int i=4;
}
@OverRide
protected void after() {
}
public start(){
}
}
>
|
JUnitMigrationCleanUpTest.testJUnitCleanupThreeFiles:
sandbox_junit_cleanup_test/src/org/eclipse/jdt/ui/tests/quickfix/Java8/JUnitMigrationCleanUpTest.java#L1085
expected: <package test;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import test.MyExternalResource;
public class MyTest {
@RegisterExtension
public MyExternalResource er= new MyExternalResource();
@test
public void test3() {
}
}
package test;
import org.junit.jupiter.api.extension.ExtensionContext;
import test.MyExternalResource2;
public class MyExternalResource extends MyExternalResource2 {
@OverRide
public void beforeEach(ExtensionContext context) {
super.beforeEach(context);
int i=4;
}
@OverRide
public void afterEach(ExtensionContext context) {
}
}
package test;
import org.junit.jupiter.api.extension.AfterEachCallback;
import org.junit.jupiter.api.extension.BeforeEachCallback;
import org.junit.jupiter.api.extension.ExtensionContext;
public class MyExternalResource2 implements BeforeEachCallback, AfterEachCallback {
@OverRide
public void beforeEach(ExtensionContext context) {
super.beforeEach(context);
int i=4;
}
@OverRide
public void afterEach(ExtensionContext context) {
}
}
> but was: <package test;
import org.junit.Test;
import org.junit.Rule;
import test.MyExternalResource;
public class MyTest {
@rule
public MyExternalResource er= new MyExternalResource();
@test
public void test3() {
}
}
package test;
import test.MyExternalResource2;
public class MyExternalResource extends MyExternalResource2 {
@OverRide
protected void before() throws Throwable {
super.before();
int i=4;
}
@OverRide
protected void after() {
}
}
package test;
import org.junit.rules.ExternalResource;
public class MyExternalResource2 extends ExternalResource {
@OverRide
protected void before() throws Throwable {
super.before();
int i=4;
}
@OverRide
protected void after() {
}
}
>
|
Codacy Security Scan
Calculated fingerprint of 98a5e2c162bc137d:1 for file sandbox_web/src/main/webapp/index.jsp line 1, but found existing inconsistent fingerprint value db2c16a22a372e70c7b96fa69c474c77
|
Codacy Security Scan
Calculated fingerprint of 41513f121688ec67:1 for file sandbox_platform_helper_test/src/org/sandbox/jdt/ui/tests/quickfix/Java8CleanUpTest.java line 138, but found existing inconsistent fingerprint value cd2db2d589478918d0051c6b62185427
|
Codacy Security Scan
Calculated fingerprint of 35864a1f20bcf66c:1 for file sandbox_platform_helper_test/src/org/sandbox/jdt/ui/tests/quickfix/Java8CleanUpTest.java line 146, but found existing inconsistent fingerprint value 72cac5d71d2c8ad8422b02cc6eb2b061
|
Codacy Security Scan
Calculated fingerprint of 15880f00251e21ca:1 for file sandbox_junit_cleanup/src/org/sandbox/jdt/internal/corext/fix/helper/AbstractTool.java line 138, but found existing inconsistent fingerprint value 264d470b85e3b7332cffeef7f55ddf35
|
Codacy Security Scan
Calculated fingerprint of c0ba29c1cca313a4:1 for file sandbox_junit_cleanup/src/org/sandbox/jdt/internal/corext/fix/helper/AbstractTool.java line 272, but found existing inconsistent fingerprint value 32f8df820892b1dcc1cd9fdc2995a7c3
|
Codacy Security Scan
Calculated fingerprint of 6a6637cc49d5aaa7:1 for file sandbox_junit_cleanup/src/org/sandbox/jdt/internal/corext/fix/helper/AbstractTool.java line 313, but found existing inconsistent fingerprint value b22284f1d31f40b358bb0d0a2f7f10cd
|
Codacy Security Scan
Calculated fingerprint of 83e62a87f35bb775:1 for file sandbox_junit_cleanup/src/org/sandbox/jdt/internal/corext/fix/helper/AbstractTool.java line 355, but found existing inconsistent fingerprint value b22284f1d31f40b358bb0d0a2f7f10cd
|
Codacy Security Scan
Calculated fingerprint of c60700457097b205:1 for file sandbox_junit_cleanup/src/org/sandbox/jdt/internal/corext/fix/helper/AbstractTool.java line 424, but found existing inconsistent fingerprint value af4d45673834267c810d36ecc2ed617f
|
Codacy Security Scan
Calculated fingerprint of 381e0a1829a5e1d4:1 for file sandbox_junit_cleanup/src/org/sandbox/jdt/internal/corext/fix/helper/AbstractTool.java line 493, but found existing inconsistent fingerprint value 32f8df820892b1dcc1cd9fdc2995a7c3
|
Codacy Security Scan
Calculated fingerprint of 244392de7c1737b5:1 for file sandbox_functional_converter/src/org/sandbox/jdt/internal/corext/fix/helper/ProspectiveOperation.java line 60, but found existing inconsistent fingerprint value 90fa10e76839aec0539b1fae215f945f
|