Skip to content

Commit a9e9820

Browse files
committed
Tester implements
1 parent 054c813 commit a9e9820

File tree

5 files changed

+11
-10
lines changed

5 files changed

+11
-10
lines changed
0 Bytes
Binary file not shown.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Thu May 04 15:40:26 MSK 2017
1+
#Mon May 15 12:42:24 MSK 2017
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-bin.zip

006-Xunit/src/main/java/task/Tester/Tester.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
import java.lang.reflect.Method;
1111
import java.lang.reflect.Modifier;
1212
import java.util.*;
13+
import java.util.concurrent.Callable;
1314

14-
public class Tester {
15+
public class Tester implements Callable<List<TestResult>> {
1516
private final static List<Class<? extends Annotation> > supportedAnnotations = ImmutableList.of(
1617
Test.class,
1718
After.class,
@@ -40,7 +41,7 @@ public Tester(@NotNull Class<?> clazz) throws NoSuchMethodException, IllegalAcce
4041
}
4142
}
4243

43-
public List<TestResult> execute() {
44+
public List<TestResult> call() {
4445
List<TestResult> res = new ArrayList<>();
4546
try {
4647
for (Method method : annotatedMethods.get(BeforeClass.class)) {

006-Xunit/src/main/java/task/Tester/TestsRunner.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public static void run(@NotNull Path path, @NotNull String rootPackage) throws I
1212
Loader loader = new Loader();
1313
List<Class<?>> testClasses = loader.load(path, rootPackage);
1414
for (Class<?> clazz : testClasses) {
15-
new Tester(clazz).execute();
15+
new Tester(clazz).call();
1616
}
1717
}
1818
}

006-Xunit/src/test/java/Test.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,35 +32,35 @@ public void testTestsRunner() throws InvocationTargetException, NoSuchMethodExce
3232

3333
@org.junit.Test
3434
public void testException() throws InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException {
35-
TestResult result = new Tester(TestException.class).execute().get(0);
35+
TestResult result = new Tester(TestException.class).call().get(0);
3636
assertThat(result.ok, is(equalTo(false)));
3737
assertThat(result.exception, allOf(is(instanceOf(RuntimeException.class)), not(is(nullValue()))));
3838
}
3939

4040
@org.junit.Test
4141
public void testExpectedException() throws InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException {
42-
TestResult result = new Tester(TestExpectedExcetion.class).execute().get(0);
42+
TestResult result = new Tester(TestExpectedExcetion.class).call().get(0);
4343
assertThat(result.ok, is(equalTo(true)));
4444
assertThat(result.exception, is(nullValue()));
4545
}
4646

4747
@org.junit.Test
4848
public void testUnexpectedException() throws InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException {
49-
TestResult result = new Tester(TestUnexpectedExcetion.class).execute().get(0);
49+
TestResult result = new Tester(TestUnexpectedExcetion.class).call().get(0);
5050
assertThat(result.ok, is(equalTo(false)));
5151
assertThat(result.exception, allOf(is(instanceOf(UnsupportedOperationException.class)), not(is(nullValue()))));
5252
}
5353

5454
@org.junit.Test
5555
public void testPassed() throws InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException {
56-
TestResult result = new Tester(TestPassed.class).execute().get(0);
56+
TestResult result = new Tester(TestPassed.class).call().get(0);
5757
assertThat(result.ok, is(equalTo(true)));
5858
assertThat(result.exception, is(nullValue()));
5959
}
6060

6161
@org.junit.Test
6262
public void testIgnored() throws InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException {
63-
TestResult result = new Tester(TestIgnored.class).execute().get(0);
63+
TestResult result = new Tester(TestIgnored.class).call().get(0);
6464
assertThat(result.ok, is(equalTo(true)));
6565
assertThat(result.exception, is(nullValue()));
6666
assertThat(result.message, containsString("ignore"));

0 commit comments

Comments
 (0)