Skip to content

Commit

Permalink
rewritten README.md using new api
Browse files Browse the repository at this point in the history
  • Loading branch information
maciejmikosik committed Mar 14, 2015
1 parent 8e980f1 commit 22cb2ff
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
Testanza lets you write reusable tests by implementing simple interface.

public interface Tester<T> {
Test test(T item);
Quackery lets you test if your code quacks like intended type.

Try adding this Junit3-style code to test class.

@RunWith(AllTests.class)
public class JdkCollectionTest {
public static junit.framework.Test suite() {
return junit(newSuite("jdk collections quack like java.util.Collection")
.testThat(ArrayList.class, quacksLike(Collection.class))
.testThat(LinkedList.class, quacksLike(Collection.class))
.testThat(HashSet.class, quacksLike(Collection.class)));
}
}

Then you can build test suite for your particular class.

testThat(MyList.class, obeysCollectionContract());
testThat(MyList.class, obeysListContract());
testThat(MyList.class, isAssignableTo(Serializable.class));

This will create a hierarchy of test for your class.

![MyListTest.png](main/doc/MyListTest.png "MyListTest.png")
Run it with junit test runner to see something like this.

You can use built-in `Testers` or create your own.
![JdkTest.png](main/doc/JdkTest.png "JdkTest.png")

You can aggregate smaller `Testers` into more abstract contracts.
You can use built-in contracts or create your own.

See [tutorial](main/doc/tutorial.md) for all features.
Binary file added main/doc/JdkTest.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed main/doc/MyListTest.png
Binary file not shown.

0 comments on commit 22cb2ff

Please sign in to comment.