Skip to content

Instantly share code, notes, and snippets.

@lchanmann
Created August 23, 2016 22:35
Show Gist options
  • Save lchanmann/9d03f8b0b6fe91d93bd0615d7c6d1d87 to your computer and use it in GitHub Desktop.
Save lchanmann/9d03f8b0b6fe91d93bd0615d7c6d1d87 to your computer and use it in GitHub Desktop.
JMinitest: assert linklist's head and tail
public class Program {
public static void main(String[] args) {
LinkedList list = new LinkedList();
assert list.size() == 0 : "Expected 0 but was " + list.size();
assert list.getHead() == null : "Expecte null but was " + list.getHead();
assert list.getTail() == null : "Expecte null but was " + list.getTail();
// All tests are passed!
System.out.println("All tests are passed!");
}
}
// LinkedList class
class LinkedList {
public Object getHead() {
return null;
}
public Object getTail() {
return null;
}
public int size() {
return 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment