Created
January 17, 2013 23:58
-
-
Save chintanparikh/4561045 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| @Test | |
| public void testRemoveInt() { | |
| list.add(i); | |
| list.add(j); | |
| assertTrue(list.remove(0).equals(i)); | |
| assertFalse(list.getHead().equals(i)); | |
| assertTrue(list.getHead().equals(j)); | |
| assertTrue(list.remove(0).equals(j)); | |
| assertTrue(list.getHead() == null); | |
| list.add(i); | |
| list.add(j); | |
| assertTrue(list.remove(1).equals(j)); | |
| assertTrue(list.getHead().getNext().getData() == i); | |
| boolean thrown = false; | |
| try | |
| { | |
| list.remove(1); | |
| } | |
| catch (IndexOutOfBoundsException e) | |
| { | |
| thrown = true; | |
| } | |
| assertTrue(thrown); | |
| thrown = false; | |
| try | |
| { | |
| list.remove(-1); | |
| } | |
| catch (IndexOutOfBoundsException e) | |
| { | |
| thrown = true; | |
| } | |
| assertTrue(thrown); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment