diff --git a/src/test/java/spoon/reflect/ast/CloneTest.java b/src/test/java/spoon/reflect/ast/CloneTest.java index 2075fe93b98..6a4b83fea56 100644 --- a/src/test/java/spoon/reflect/ast/CloneTest.java +++ b/src/test/java/spoon/reflect/ast/CloneTest.java @@ -16,7 +16,6 @@ */ package spoon.reflect.ast; -import org.junit.Assert; import org.junit.Test; import spoon.Launcher; import spoon.processing.AbstractProcessor; @@ -44,6 +43,7 @@ import java.util.stream.Collectors; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; @@ -125,7 +125,7 @@ public void process(CtConditional conditional) { assertEquals(conditional, clone); conditional.addTypeCast(getFactory().Type().bytePrimitiveType()); assertEquals(1, conditional.getTypeCasts().size()); - Assert.assertNotEquals(conditional, clone); + assertNotEquals(conditional, clone); clone = conditional.clone(); assertEquals(conditional, clone); assertEquals(1, clone.getTypeCasts().size()); diff --git a/src/test/java/spoon/reflect/declaration/CtTypeInformationTest.java b/src/test/java/spoon/reflect/declaration/CtTypeInformationTest.java index fa8ee15d271..2b1c81a5c58 100644 --- a/src/test/java/spoon/reflect/declaration/CtTypeInformationTest.java +++ b/src/test/java/spoon/reflect/declaration/CtTypeInformationTest.java @@ -17,7 +17,6 @@ package spoon.reflect.declaration; import org.apache.commons.lang3.StringUtils; -import org.junit.Assert; import org.junit.Before; import org.junit.Test; import spoon.Launcher; @@ -38,6 +37,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; @@ -196,7 +196,7 @@ public void testGetSuperclass() { CtMethod fooAbstract = type2.getMethodsByName("foo").get(0); assertEquals(fooConcrete.getSignature(), fooAbstract.getSignature()); // yet they are different AST node - Assert.assertNotEquals(fooConcrete, fooAbstract); + assertNotEquals(fooConcrete, fooAbstract); assertEquals(subClass.getMethodsByName("foo").get(0).getSignature(), type2.getMethodsByName("foo").get(0).getSignature()); diff --git a/src/test/java/spoon/reflect/visitor/CtInheritanceScannerTest.java b/src/test/java/spoon/reflect/visitor/CtInheritanceScannerTest.java index 0d773fa9a9c..1bb76ac4575 100644 --- a/src/test/java/spoon/reflect/visitor/CtInheritanceScannerTest.java +++ b/src/test/java/spoon/reflect/visitor/CtInheritanceScannerTest.java @@ -16,7 +16,6 @@ */ package spoon.reflect.visitor; -import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -32,6 +31,7 @@ import java.util.List; import java.util.Queue; +import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; @@ -85,7 +85,7 @@ private List getMethodToInvoke(Class entry) { while (!tocheck.isEmpty()) { Class intf = tocheck.poll(); - Assert.assertTrue(intf.isInterface()); + assertTrue(intf.isInterface()); if (!intf.getSimpleName().startsWith("Ct")) { continue; } diff --git a/src/test/java/spoon/support/compiler/classpath/ComputeClasspathTest.java b/src/test/java/spoon/support/compiler/classpath/ComputeClasspathTest.java index 64411f614d6..5870256ea0a 100644 --- a/src/test/java/spoon/support/compiler/classpath/ComputeClasspathTest.java +++ b/src/test/java/spoon/support/compiler/classpath/ComputeClasspathTest.java @@ -16,7 +16,6 @@ */ package spoon.support.compiler.classpath; -import org.junit.Assert; import org.junit.Before; import org.junit.Test; import spoon.Launcher; @@ -27,6 +26,8 @@ import java.io.File; +import static org.junit.Assert.assertEquals; + public class ComputeClasspathTest { private static final String TEST_CLASSPATH = @@ -64,6 +65,6 @@ public SpoonModelBuilder createCompiler(Factory factory) { @Test public void testSourceClasspath() { final ClasspathOptions options = new ClasspathOptions().classpath(systemClasspath); - Assert.assertEquals("-cp " + TEST_CLASSPATH, String.join(" ", options.build())); + assertEquals("-cp " + TEST_CLASSPATH, String.join(" ", options.build())); } } diff --git a/src/test/java/spoon/test/OutputTypeTest.java b/src/test/java/spoon/test/OutputTypeTest.java index bd5359f1ebc..7469791ffe3 100644 --- a/src/test/java/spoon/test/OutputTypeTest.java +++ b/src/test/java/spoon/test/OutputTypeTest.java @@ -16,25 +16,26 @@ */ package spoon.test; -import org.junit.Assert; import org.junit.Test; - import spoon.OutputType; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + public class OutputTypeTest { @Test public void testOutputTypeLoading() { OutputType outputType = OutputType.fromString("nulltest"); - Assert.assertNull(outputType); + assertNull(outputType); outputType = OutputType.fromString("nooutput"); - Assert.assertEquals(OutputType.NO_OUTPUT, outputType); + assertEquals(OutputType.NO_OUTPUT, outputType); outputType = OutputType.fromString("classes"); - Assert.assertEquals(OutputType.CLASSES, outputType); + assertEquals(OutputType.CLASSES, outputType); outputType = OutputType.fromString("compilationunits"); - Assert.assertEquals(OutputType.COMPILATION_UNITS, outputType); + assertEquals(OutputType.COMPILATION_UNITS, outputType); } } diff --git a/src/test/java/spoon/test/api/MetamodelTest.java b/src/test/java/spoon/test/api/MetamodelTest.java index bfb5deba7d0..d6107e54a45 100644 --- a/src/test/java/spoon/test/api/MetamodelTest.java +++ b/src/test/java/spoon/test/api/MetamodelTest.java @@ -16,7 +16,6 @@ */ package spoon.test.api; -import org.junit.Assert; import org.junit.Test; import spoon.Launcher; import spoon.SpoonAPI; @@ -664,26 +663,26 @@ public void listValueRoleSetOn() { assertEquals(1, typeMembers.size()); assertEquals(1, ctClass.getTypeMembers().size()); assertSame(ctClass, field1.getDeclaringType()); - Assert.assertThat(Arrays.asList("field1"), is(ctClass.filterChildren(new TypeFilter(CtField.class)).map((CtField e) -> e.getSimpleName()).list())); + assertThat(Arrays.asList("field1"), is(ctClass.filterChildren(new TypeFilter(CtField.class)).map((CtField e) -> e.getSimpleName()).list())); //contract: call of add on RoleHandler collection adds the item into real collection too typeMembers.add(field2); assertSame(ctClass, field2.getDeclaringType()); - Assert.assertThat(Arrays.asList("field1", "field2"), is(ctClass.filterChildren(new TypeFilter(CtField.class)).map((CtField e) -> e.getSimpleName()).list())); + assertThat(Arrays.asList("field1", "field2"), is(ctClass.filterChildren(new TypeFilter(CtField.class)).map((CtField e) -> e.getSimpleName()).list())); //contract: call of set on RoleHandler collection replaces the item in real collection typeMembers.set(0, field3); assertSame(ctClass, field3.getDeclaringType()); - Assert.assertThat(Arrays.asList("field3", "field2"), is(ctClass.filterChildren(new TypeFilter(CtField.class)).map((CtField e) -> e.getSimpleName()).list())); + assertThat(Arrays.asList("field3", "field2"), is(ctClass.filterChildren(new TypeFilter(CtField.class)).map((CtField e) -> e.getSimpleName()).list())); typeMembers.set(1, field1); - Assert.assertThat(Arrays.asList("field3", "field1"), is(ctClass.filterChildren(new TypeFilter(CtField.class)).map((CtField e) -> e.getSimpleName()).list())); + assertThat(Arrays.asList("field3", "field1"), is(ctClass.filterChildren(new TypeFilter(CtField.class)).map((CtField e) -> e.getSimpleName()).list())); //contract: call of remove(int) on RoleHandler collection removes the item in real collection assertSame(field3, typeMembers.remove(0)); - Assert.assertThat(Arrays.asList("field1"), is(ctClass.filterChildren(new TypeFilter(CtField.class)).map((CtField e) -> e.getSimpleName()).list())); + assertThat(Arrays.asList("field1"), is(ctClass.filterChildren(new TypeFilter(CtField.class)).map((CtField e) -> e.getSimpleName()).list())); //contract: call of remove(Object) which does not exist does nothing assertFalse(typeMembers.remove(field2)); - Assert.assertThat(Arrays.asList("field1"), is(ctClass.filterChildren(new TypeFilter(CtField.class)).map((CtField e) -> e.getSimpleName()).list())); + assertThat(Arrays.asList("field1"), is(ctClass.filterChildren(new TypeFilter(CtField.class)).map((CtField e) -> e.getSimpleName()).list())); //contract: call of remove(Object) on RoleHandler collection removes the item in real collection assertTrue(typeMembers.remove(field1)); - Assert.assertThat(Arrays.asList(), is(ctClass.filterChildren(new TypeFilter(CtField.class)).map((CtField e) -> e.getSimpleName()).list())); + assertThat(Arrays.asList(), is(ctClass.filterChildren(new TypeFilter(CtField.class)).map((CtField e) -> e.getSimpleName()).list())); } @Test diff --git a/src/test/java/spoon/test/factory/FieldFactoryTest.java b/src/test/java/spoon/test/factory/FieldFactoryTest.java index ec94c600b12..1819901e8f6 100644 --- a/src/test/java/spoon/test/factory/FieldFactoryTest.java +++ b/src/test/java/spoon/test/factory/FieldFactoryTest.java @@ -16,7 +16,6 @@ */ package spoon.test.factory; -import org.junit.Assert; import org.junit.Test; import spoon.reflect.declaration.CtClass; import spoon.reflect.declaration.CtElement; @@ -33,6 +32,8 @@ import java.util.HashSet; import java.util.Set; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import static spoon.testing.utils.ModelUtils.build; public class FieldFactoryTest { @@ -50,12 +51,12 @@ public void testCreate() throws Exception { ff.create(type,mods,tref,"name"); CtField field = type.getField("name"); - Assert.assertEquals("name", field.getSimpleName()); - Assert.assertEquals(tref, field.getType()); + assertEquals("name", field.getSimpleName()); + assertEquals(tref, field.getType()); CtElement parent = field.getParent(); - Assert.assertTrue(parent instanceof CtClass); - Assert.assertEquals("SampleClass", ((CtClass)parent).getSimpleName()); + assertTrue(parent instanceof CtClass); + assertEquals("SampleClass", ((CtClass)parent).getSimpleName()); } @Test @@ -71,12 +72,12 @@ public void testCreateFromSource() throws Exception { ff.create(target,source); CtField field = target.getField("i"); - Assert.assertEquals("i", field.getSimpleName()); + assertEquals("i", field.getSimpleName()); CtTypeReference tref = tf.createReference("int"); - Assert.assertEquals(tref, field.getType()); + assertEquals(tref, field.getType()); CtElement parent = field.getParent(); - Assert.assertTrue(parent instanceof CtClass); - Assert.assertEquals("SampleClass", ((CtClass)parent).getSimpleName()); + assertTrue(parent instanceof CtClass); + assertEquals("SampleClass", ((CtClass)parent).getSimpleName()); } } diff --git a/src/test/java/spoon/test/imports/ImportAndExtendWithPackageNameTest.java b/src/test/java/spoon/test/imports/ImportAndExtendWithPackageNameTest.java index c05f5003879..28e8a9a7608 100644 --- a/src/test/java/spoon/test/imports/ImportAndExtendWithPackageNameTest.java +++ b/src/test/java/spoon/test/imports/ImportAndExtendWithPackageNameTest.java @@ -16,7 +16,6 @@ */ package spoon.test.imports; -import org.junit.Assert; import org.junit.Test; import spoon.Launcher; import spoon.reflect.declaration.CtType; @@ -24,6 +23,9 @@ import java.util.Collection; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertSame; + public class ImportAndExtendWithPackageNameTest { private static final String inputResource = @@ -37,12 +39,12 @@ public void testBuildModel() { runLaunch.buildModel(); final Collection> types = runLaunch.getModel().getAllTypes(); - Assert.assertSame(1, types.size()); + assertSame(1, types.size()); final CtType type = types.iterator().next(); - Assert.assertEquals("ImportAndExtendWithPackageName", type.getSimpleName()); + assertEquals("ImportAndExtendWithPackageName", type.getSimpleName()); final CtTypeReference superClass = type.getSuperclass(); - Assert.assertEquals("LLkParser", superClass.getSimpleName()); + assertEquals("LLkParser", superClass.getSimpleName()); } } diff --git a/src/test/java/spoon/test/intercession/IntercessionTest.java b/src/test/java/spoon/test/intercession/IntercessionTest.java index 807fc9eb60a..c61958ede14 100644 --- a/src/test/java/spoon/test/intercession/IntercessionTest.java +++ b/src/test/java/spoon/test/intercession/IntercessionTest.java @@ -16,7 +16,6 @@ */ package spoon.test.intercession; -import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; import spoon.Launcher; @@ -52,6 +51,7 @@ import java.util.List; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -99,7 +99,7 @@ public void testInsertEnd() { assertEquals(3, body.getStatements().size()); assertSame(returnStmt, body.getStatements().get(2)); - Assert.assertNotEquals(foo, fooClone); + assertNotEquals(foo, fooClone); } @Test @@ -125,7 +125,7 @@ public void testEqualConstructor() { assertEquals(2, body.getStatements().size()); // constructor are not equals anymore - Assert.assertNotEquals(foo, fooClone); + assertNotEquals(foo, fooClone); } @Test diff --git a/src/test/java/spoon/test/jar/JarTest.java b/src/test/java/spoon/test/jar/JarTest.java index a7e1a092440..11c3ee678ce 100644 --- a/src/test/java/spoon/test/jar/JarTest.java +++ b/src/test/java/spoon/test/jar/JarTest.java @@ -16,19 +16,7 @@ */ package spoon.test.jar; -import static org.junit.Assert.assertEquals; - -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.UnsupportedEncodingException; -import java.util.Arrays; -import java.util.List; - -import org.junit.Assert; import org.junit.Test; - import spoon.Launcher; import spoon.SpoonModelBuilder; import spoon.compiler.SpoonFile; @@ -38,6 +26,18 @@ import spoon.support.compiler.VirtualFile; import spoon.support.compiler.ZipFolder; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.util.Arrays; +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + public class JarTest { @Test @@ -56,7 +56,7 @@ public void testJarResources() throws Exception { "\n" + "", readFileString(files.stream().filter(f -> f.getName().equals(".classpath")).findFirst().get(), "ISO-8859-1")); } - + private byte[] readFileBytes(SpoonFile file) { byte[] buff = new byte[1024]; try (InputStream is = file.getContent(); ByteArrayOutputStream baos = new ByteArrayOutputStream()) { @@ -72,6 +72,7 @@ private byte[] readFileBytes(SpoonFile file) { throw new RuntimeException(e); } } + private String readFileString(SpoonFile file, String encoding) { try { return new String(readFileBytes(file), encoding); @@ -89,7 +90,7 @@ public void testJar() throws Exception { SpoonModelBuilder compiler = spoon.createCompiler( factory, SpoonResourceHelper.resources("./src/test/resources/sourceJar/test.jar")); - Assert.assertTrue(compiler.build()); + assertTrue(compiler.build()); assertEquals(1, factory.getModel().getAllTypes().size()); assertEquals("spoon.test.strings.Main", factory.getModel().getAllTypes().iterator().next().getQualifiedName()); } @@ -102,9 +103,9 @@ public void testFile() throws Exception { launcher.getFactory(), Arrays.asList( SpoonResourceHelper.createFile(new File("./src/test/resources/spoon/test/api/Foo.java")))); - Assert.assertTrue(compiler.build()); + assertTrue(compiler.build()); - Assert.assertNotNull(launcher.getFactory().Type().get("Foo")); + assertNotNull(launcher.getFactory().Type().get("Foo")); } @Test @@ -116,9 +117,8 @@ public void testResource() { Arrays.asList( new VirtualFile("class Foo {}" , "Foo.java") )); - Assert.assertTrue(compiler.build()); + assertTrue(compiler.build()); - Assert.assertNotNull(launcher.getFactory().Type().get("Foo")); + assertNotNull(launcher.getFactory().Type().get("Foo")); } - } diff --git a/src/test/java/spoon/test/pkg/PackageTest.java b/src/test/java/spoon/test/pkg/PackageTest.java index f1f69ae8ba0..be563e5007e 100644 --- a/src/test/java/spoon/test/pkg/PackageTest.java +++ b/src/test/java/spoon/test/pkg/PackageTest.java @@ -16,7 +16,6 @@ */ package spoon.test.pkg; -import org.junit.Assert; import org.junit.Test; import spoon.Launcher; import spoon.OutputType; @@ -50,6 +49,8 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static spoon.testing.Assert.assertThat; @@ -69,7 +70,7 @@ public void testPackage() throws Exception { spoon.createCompiler(factory, SpoonResourceHelper.resources(classFilePath, packageInfoFilePath)).build(); CtClass clazz = factory.Class().get(PackageTestClass.class); - Assert.assertSame(PackageTestClass.class, clazz.getActualClass()); + assertSame(PackageTestClass.class, clazz.getActualClass()); CtPackage ctPackage = clazz.getPackage(); assertEquals("spoon.test.pkg.name", ctPackage.getQualifiedName()); @@ -78,7 +79,7 @@ public void testPackage() throws Exception { ctPackage = (CtPackage) ctPackage.getParent(); assertEquals("spoon.test.pkg", ctPackage.getQualifiedName()); - Assert.assertNotNull(ctPackage.getPosition()); + assertNotNull(ctPackage.getPosition()); assertEquals(packageInfoFile.getCanonicalPath(), ctPackage.getPosition().getFile().getCanonicalPath()); assertEquals(1, ctPackage.getPosition().getLine()); assertEquals(0, ctPackage.getPosition().getSourceStart()); @@ -87,7 +88,7 @@ public void testPackage() throws Exception { assertEquals("This is test\nJavaDoc.", ctPackage.getComments().get(0).getContent()); CtAnnotation annotation = ctPackage.getAnnotations().get(0); - Assert.assertSame(Deprecated.class, annotation.getAnnotationType().getActualClass()); + assertSame(Deprecated.class, annotation.getAnnotationType().getActualClass()); assertEquals(packageInfoFile.getCanonicalPath(), annotation.getPosition().getFile().getCanonicalPath()); assertEquals(5, annotation.getPosition().getLine()); diff --git a/src/test/java/spoon/test/reflect/visitor/ReferenceQueryTest.java b/src/test/java/spoon/test/reflect/visitor/ReferenceQueryTest.java index 4ce35454a4d..5346bd29b59 100644 --- a/src/test/java/spoon/test/reflect/visitor/ReferenceQueryTest.java +++ b/src/test/java/spoon/test/reflect/visitor/ReferenceQueryTest.java @@ -16,7 +16,6 @@ */ package spoon.test.reflect.visitor; -import org.junit.Assert; import org.junit.Test; import spoon.reflect.declaration.CtEnum; import spoon.reflect.factory.TypeFactory; @@ -27,6 +26,7 @@ import java.util.List; +import static org.junit.Assert.assertTrue; import static spoon.testing.utils.ModelUtils.build; public class ReferenceQueryTest { @@ -36,7 +36,7 @@ public void getAllTypeReferencesInEnum() throws Exception { List< CtTypeReference > enumTypeRefs = Query.getElements(testEnum, new ReferenceTypeFilter<>(CtTypeReference.class)); TypeFactory typeFactory = testEnum.getFactory().Type(); for (Class c : new Class[]{Integer.class, Long.class, Boolean.class, Number.class, String.class, Void.class}) { - Assert.assertTrue("the reference query on the enum should return all the types defined in the enum declaration", enumTypeRefs.contains(typeFactory.createReference(c))); + assertTrue("the reference query on the enum should return all the types defined in the enum declaration", enumTypeRefs.contains(typeFactory.createReference(c))); } } -} \ No newline at end of file +} diff --git a/src/test/java/spoon/test/replace/ReplaceTest.java b/src/test/java/spoon/test/replace/ReplaceTest.java index 2211f11ffa6..ea9e63f4199 100644 --- a/src/test/java/spoon/test/replace/ReplaceTest.java +++ b/src/test/java/spoon/test/replace/ReplaceTest.java @@ -16,7 +16,6 @@ */ package spoon.test.replace; -import org.junit.Assert; import org.junit.Before; import org.junit.Test; import spoon.Launcher; @@ -56,7 +55,10 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static spoon.testing.utils.ModelUtils.build; import static spoon.testing.utils.ModelUtils.buildClass; @@ -240,8 +242,8 @@ public void testReplaceField() { replacement.setSimpleName("j"); replacement.setType(factory.Type().createReference(double.class)); sample.getField("i").replace(replacement); - Assert.assertNull(sample.getField("i")); - Assert.assertNotNull(sample.getField("j")); + assertNull(sample.getField("i")); + assertNotNull(sample.getField("j")); assertEquals(factory.Type().createReference(double.class), sample.getField("j").getType()); } @@ -250,16 +252,16 @@ public void testReplaceMethod() { CtClass sample = factory.Package().get("spoon.test.replace.testclasses") .getType("Foo"); - Assert.assertNotNull(sample.getMethod("foo")); - Assert.assertNull(sample.getMethod("notfoo")); + assertNotNull(sample.getMethod("foo")); + assertNull(sample.getMethod("notfoo")); CtMethod bar = factory.Core().createMethod(); bar.setSimpleName("notfoo"); bar.setType(factory.Type().createReference(void.class)); sample.getMethod("foo").replace(bar); - Assert.assertNull(sample.getMethod("foo")); - Assert.assertNotNull(sample.getMethod("notfoo")); + assertNull(sample.getMethod("foo")); + assertNotNull(sample.getMethod("notfoo")); } @Test @@ -267,8 +269,8 @@ public void testReplaceTwoMethods() { CtClass sample = factory.Package().get("spoon.test.replace.testclasses") .getType("Foo"); - Assert.assertNotNull(sample.getMethod("foo")); - Assert.assertNull(sample.getMethod("notfoo")); + assertNotNull(sample.getMethod("foo")); + assertNull(sample.getMethod("notfoo")); CtMethod bar = factory.Core().createMethod(); bar.setSimpleName("notfoo"); @@ -279,9 +281,9 @@ public void testReplaceTwoMethods() { int originCountOfMethods = sample.getTypeMembers().size(); sample.getMethod("foo").replace(Arrays.asList(bar, bar2)); - Assert.assertNull(sample.getMethod("foo")); - Assert.assertNotNull(sample.getMethod("notfoo")); - Assert.assertNotNull(sample.getMethod("notfoo2")); + assertNull(sample.getMethod("foo")); + assertNotNull(sample.getMethod("notfoo")); + assertNotNull(sample.getMethod("notfoo2")); assertEquals(originCountOfMethods+1, sample.getTypeMembers().size()); } @@ -292,7 +294,7 @@ public void testReplaceExpression() { CtVariable var = sample.getBody().getStatement(0); - Assert.assertTrue(var.getDefaultExpression() instanceof CtLiteral); + assertTrue(var.getDefaultExpression() instanceof CtLiteral); assertEquals(3, ((CtLiteral) var.getDefaultExpression()).getValue()); CtLiteral replacement = factory.Core().createLiteral(); @@ -308,12 +310,12 @@ public void testReplaceStatement() { CtMethod sample = factory.Package().get("spoon.test.replace.testclasses") .getType("Foo").getMethod("foo"); - Assert.assertTrue(sample.getBody().getStatement(0) instanceof CtVariable); + assertTrue(sample.getBody().getStatement(0) instanceof CtVariable); CtStatement replacement = factory.Core().createInvocation(); sample.getBody().getStatement(0).replace(replacement); - Assert.assertTrue(sample.getBody().getStatement(0) instanceof CtInvocation); + assertTrue(sample.getBody().getStatement(0) instanceof CtInvocation); } @Test