-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
8e980f1
commit 22cb2ff
Showing
3 changed files
with
15 additions
and
15 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -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. | ||
|
||
 | ||
Run it with junit test runner to see something like this. | ||
|
||
You can use built-in `Testers` or create your own. | ||
 | ||
|
||
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. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.