Last active
August 29, 2015 14:03
-
-
Save up1/b37aa3787f9540ef5358 to your computer and use it in GitHub Desktop.
Demo :: JUnit + Oleaster
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
import org.junit.runner.RunWith; | |
import static org.junit.Assert.*; | |
import static com.mscharhag.oleaster.runner.StaticRunnerSupport.*; | |
import com.mscharhag.oleaster.runner.OleasterRunner; | |
@RunWith(OleasterRunner.class) | |
public class FizzBuzzTest { | |
private FizzBuzz fizzBuzz; | |
public FizzBuzzTest() { | |
describe("Fizzbuzz", () -> { | |
beforeEach(() -> { | |
fizzBuzz = new FizzBuzz(); | |
}); | |
describe("Show data", () -> { | |
it("1 จะต้องแสดงผล 1", () -> { | |
assertEquals("1", fizzBuzz.showData(1)); | |
}); | |
it("3 จะต้องแสดงผล Fizz", () -> { | |
assertEquals("Fizz", fizzBuzz.showData(3)); | |
}); | |
it("5 จะต้องแสดงผล Buzz", () -> { | |
assertEquals("Buzz", fizzBuzz.showData(5)); | |
}); | |
it("ตัวเลขหาร 3 ลงตัว จะต้องแสดงผล Fizz", () -> { | |
assertEquals("Fizz", fizzBuzz.showData(6)); | |
}); | |
it("ตัวเลขหาร 5 ลงตัว จะต้องแสดงผล Buzz", () -> { | |
assertEquals("Buzz", fizzBuzz.showData(10)); | |
}); | |
it("ตัวเลขหาร 3 และ 5 ลงตัว จะต้องแสดงผล FizzBuzz", () -> { | |
assertEquals("FizzBuzz", fizzBuzz.showData(15)); | |
}); | |
}); | |
}); | |
} | |
} |
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
import static org.junit.Assert.*; | |
import static com.mscharhag.oleaster.runner.StaticRunnerSupport.*; | |
import com.mscharhag.oleaster.runner.OleasterRunner; | |
@RunWith(OleasterRunner.class) | |
public class MyTest {{ | |
describe("A suite", () -> { | |
it("contains spec with an assertion", () -> { | |
assertEquals(2, 1 + 1); | |
}); | |
}); | |
}} |
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
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>JasmineWay</groupId> | |
<artifactId>JasmineWay</artifactId> | |
<version>0.0.1-SNAPSHOT</version> | |
<name>JasmineWay</name> | |
<repositories> | |
<repository> | |
<id>sonatype-snapshots</id> | |
<url>https://oss.sonatype.org/content/repositories/snapshots</url> | |
</repository> | |
</repositories> | |
<dependencies> | |
<dependency> | |
<groupId>com.mscharhag.oleaster</groupId> | |
<artifactId>oleaster-runner</artifactId> | |
<version>0.0.1-SNAPSHOT</version> | |
</dependency> | |
<dependency> | |
<groupId>junit</groupId> | |
<artifactId>junit</artifactId> | |
<version>4.11</version> | |
<scope>test</scope> | |
</dependency> | |
</dependencies> | |
<build> | |
<plugins> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-compiler-plugin</artifactId> | |
<version>3.1</version> | |
<configuration> | |
<source>1.8</source> | |
<target>1.8</target> | |
</configuration> | |
</plugin> | |
</plugins> | |
</build> | |
</project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment