-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
49 additions
and
40 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
stylechecker/src/test/java/com/sqatntu/stylechecker/ListenerTest.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,45 @@ | ||
package com.sqatntu.stylechecker; | ||
|
||
import org.junit.After; | ||
import org.junit.Before; | ||
import org.junit.Rule; | ||
import org.junit.rules.TestName; | ||
|
||
import java.io.IOException; | ||
import java.lang.annotation.Annotation; | ||
import java.lang.reflect.Method; | ||
|
||
/** | ||
* Created by andyccs on 11/10/15. | ||
*/ | ||
public class ListenerTest { | ||
|
||
@Rule | ||
public TestName name = new TestName(); | ||
|
||
protected String testCode; | ||
protected String testConfig; | ||
|
||
@Before | ||
public void before() throws NoSuchMethodException, IOException { | ||
Method method = this.getClass().getMethod(name.getMethodName()); | ||
Annotation[] annotations = method.getDeclaredAnnotations(); | ||
|
||
for(Annotation annotation : annotations) { | ||
if(annotation instanceof TestCode){ | ||
TestCode testCodeAnnotation = (TestCode) annotation; | ||
testCode = TestUtil.loadFile(testCodeAnnotation.fileName()); | ||
} | ||
else if(annotation instanceof TestConfig) { | ||
TestConfig testConfigAnnotation = (TestConfig) annotation; | ||
testConfig = TestUtil.loadFile(testConfigAnnotation.fileName()); | ||
} | ||
} | ||
} | ||
|
||
@After | ||
public void after() { | ||
testCode = null; | ||
testConfig = null; | ||
} | ||
} |
44 changes: 4 additions & 40 deletions
44
stylechecker/src/test/java/com/sqatntu/stylechecker/listener/BraceStyleListenerTest.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