-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(junit4Asserts): improve replacement of junit4 asserts (#15)
- Rename RunState to RunMode - Fix inverted condition in TransformationEngine - change add of imports to manuell mode and disable in ImportCleaner
- Loading branch information
1 parent
f7478f0
commit e0247b1
Showing
10 changed files
with
160 additions
and
56 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
.../keksdose/spoon/code_solver/RunState.java → ...z/keksdose/spoon/code_solver/RunMode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
|
||
package xyz.keksdose.spoon.code_solver; | ||
|
||
public enum RunState { | ||
public enum RunMode { | ||
FULL, DRY_RUN; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
code-transformation/src/test/resources/projects/junittests/TestAssertions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package spoon.reflect.declaration; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertNull; | ||
|
||
import org.junit.Test; | ||
|
||
import spoon.Launcher; | ||
import spoon.reflect.reference.CtExecutableReference; | ||
import spoon.reflect.visitor.CtScanner; | ||
|
||
public class TestAssertions { | ||
|
||
private static class ExecutableReferenceVisitor extends CtScanner { | ||
|
||
int referenceCounter = 0; | ||
|
||
@Override | ||
public <T> void visitCtExecutableReference(final CtExecutableReference<T> reference) { | ||
final CtExecutable executable = reference.getDeclaration(); | ||
assertNull(executable); | ||
|
||
referenceCounter++; | ||
} | ||
} | ||
|
||
@Test | ||
public void testUnknownCalls() { | ||
final Launcher runLaunch = new Launcher(); | ||
runLaunch.getEnvironment().setNoClasspath(true); | ||
runLaunch.addInputResource("./src/test/resources/noclasspath/UnknownCalls.java"); | ||
runLaunch.buildModel(); | ||
|
||
final CtPackage rootPackage = runLaunch.getFactory().Package().getRootPackage(); | ||
final ExecutableReferenceVisitor visitor = new ExecutableReferenceVisitor(); | ||
visitor.scan(rootPackage); | ||
// super constructor to Object + | ||
// UnknownClass constructor + | ||
// UnknownClass method | ||
assertEquals(3, visitor.referenceCounter); | ||
} | ||
} |