Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
language: java
jdk:
- oraclejdk8
os:
- linux
env:
- SOURCE_DIR_1=006-Xunit
script:
- cd $SOURCE_DIR_1 && gradle check

7 changes: 7 additions & 0 deletions 006-Xunit/.idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions 006-Xunit/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version '1.0-SNAPSHOT'

apply plugin: 'java'

sourceCompatibility = 1.8

repositories {
mavenCentral()
}

dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
compile group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3'
compile 'com.intellij:annotations:+@jar'
compile group: 'com.google.guava', name: 'guava', version: '19.0'
}
Binary file added 006-Xunit/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 6 additions & 0 deletions 006-Xunit/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Mon May 15 12:42:24 MSK 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-bin.zip
172 changes: 172 additions & 0 deletions 006-Xunit/gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

84 changes: 84 additions & 0 deletions 006-Xunit/gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions 006-Xunit/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
rootProject.name = '006-junit'

62 changes: 62 additions & 0 deletions 006-Xunit/src/main/java/task/Tester/TestResult.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package task.Tester;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Имя пакета какое-то неканоничное


import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.io.PrintStream;
import java.lang.reflect.Method;

/**
* Stores result run some test.
*/
public class TestResult {
public final @NotNull Method method;
public final boolean ok;
public final @NotNull String message;
public final @Nullable Throwable exception;
public final long time;

private TestResult(@NotNull Method method, boolean ok, @NotNull String message, @Nullable Throwable exception, long time) {
this.method = method;
this.ok = ok;
this.message = message;
this.exception = exception;
this.time = time;
}

static TestResult ok(@NotNull Method method, long time) {
return new TestResult(method, true, "ok.", null, time);
}

static TestResult expectedException(@NotNull Method method, @NotNull Class<? extends Throwable> exceptionClass, long time) {
return new TestResult(method, false, "expected " + exceptionClass.getName(), null, time);
}

static TestResult exception(@NotNull Method method, @NotNull Throwable exception, long time) {
return new TestResult(method, false, "exception: ", exception, time);
}

static TestResult ignored(@NotNull Method method, @NotNull String message) {
return new TestResult(method, true, "ignore. \ncause:" + message, null, 0);
}

/**
* Prints report of result to out
*/
public void print(PrintStream out) {
out.println("Testing " + method);
if (ok) {
out.println("Ok");
out.println(message);
} else {
out.println("Fail");
out.println(message);
if (exception != null) {
exception.printStackTrace(out);
}
}
out.println("time: "+ time + "ms");
out.println();
out.println();
}
}
Loading