diff --git a/src/main/java/com/alibaba/testable/processor/TestableProcessor.java b/src/main/java/com/alibaba/testable/processor/TestableProcessor.java index 0badb84..05889b8 100644 --- a/src/main/java/com/alibaba/testable/processor/TestableProcessor.java +++ b/src/main/java/com/alibaba/testable/processor/TestableProcessor.java @@ -50,7 +50,7 @@ public class TestableProcessor extends BaseProcessor { private void createStaticNewClass() { if (!isStaticNewClassExist()) { try { - writeSourceFile(ConstPool.SN_PKG + "." + ConstPool.SN_CLS, new StaticNewClassGenerator().fetch()); + writeSourceFile(ConstPool.SN_PKG_CLS, new StaticNewClassGenerator().fetch()); } catch (IOException e) { e.printStackTrace(); } @@ -59,8 +59,9 @@ public class TestableProcessor extends BaseProcessor { private boolean isStaticNewClassExist() { try { - FileObject staticNewClassFile = filter.getResource(SOURCE_OUTPUT, ConstPool.SN_PKG, ConstPool.SN_CLS + JAVA_POSTFIX); - return staticNewClassFile.getName().contains(GENERATED_TEST_SOURCES) || staticNewClassFile.getLastModified() > 0; + FileObject staticNewClassFile = filter.getResource(SOURCE_OUTPUT, ConstPool.SN_PKG, + ConstPool.SN_CLS + JAVA_POSTFIX); + return isCompilingTestClass(staticNewClassFile) || staticNewClassFile.getLastModified() > 0; } catch (FilerException e) { return true; } catch (IOException e) { @@ -68,6 +69,10 @@ public class TestableProcessor extends BaseProcessor { } } + private boolean isCompilingTestClass(FileObject staticNewClassFile) { + return staticNewClassFile.getName().contains(GENERATED_TEST_SOURCES); + } + private void processFieldElement(Element field) { JCTree tree = trees.getTree(field); tree.accept(new TestableFieldTranslator(treeMaker));