Skip to content

Commit

Permalink
test: unit test the support by Junit3 of the two assert class
Browse files Browse the repository at this point in the history
  • Loading branch information
danglotb committed Nov 26, 2019
1 parent e787235 commit 5a1cb55
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,24 @@ private CtMethod findAndRegister(String ctClass, String methodName) {
return testExpectingAnException;
}

@Test
public void testJUnit3TestFrameworkSupportsTwoAssertClasses() {
/*
The test framework for junit 3 should recognized both class as assert class:
- junit.framework.TestCase
- junit.framework.Assert
*/

CtMethod testJUnit3 = this.findMethod("fr.inria.helper.SecondClassJUnit3", "testUsingDeprecatedAssertClass");
System.out.println(testJUnit3);
assertTrue(TestFramework.get().isTest(testJUnit3));
assertTrue(TestFramework.get().isAssert(testJUnit3.getBody().getStatement(0)));
testJUnit3 = this.findMethod("fr.inria.helper.SecondClassJUnit3", "test");
System.out.println(testJUnit3);
assertTrue(TestFramework.get().isTest(testJUnit3));
assertTrue(TestFramework.get().isAssert(testJUnit3.getBody().getStatement(0igi)));
}

@Test
public void testGenerateAfterClassToSaveObservations() {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package fr.inria.helper;

import junit.framework.TestCase;
import junit.framework.Assert;

public class SecondClassJUnit3 extends TestCase {

Expand All @@ -27,4 +28,8 @@ public void testExpectingAnException() {
throw new RuntimeException();
}

public void testUsingDeprecatedAssertClass() {
Assert.assertEquals(3, 3);
}

}

0 comments on commit 5a1cb55

Please sign in to comment.