src/textgen/MyLinkedListTester.java
/*You should not need to add much to this method.
	 * We provide it as an example of a thorough test. */
You should not need to add much to this method.
We provide it as an example of a thorough test.
You should not need to add much to this method . We provide it as an example of a thorough test .
@Test
	public void testGet()
	{
		try {
			emptyList.get(0);
			fail("Check out of bounds");
		}
		catch (IndexOutOfBoundsException e) {
			System.out.println("got an index out of bound for empty list emptyList.get(0)");
		}
		System.out.println( " shortList size ...."+shortList.size + " checking first A "+shortList.toString());
		assertEquals("Check first", "A", shortList.get(0));
		System.out.println("move on A");
		assertEquals("Check second", "B", shortList.get(1));
		System.out.println("move on B");
		try {
			shortList.get(-1);
			fail("Check out of bounds");
		}
		catch (IndexOutOfBoundsException e) {
		System.out.println( " got an index out of bound for shortList.get(-1).." );
		}
		try {
			shortList.get(2);
			fail("Check out of bounds");
		}
		catch (IndexOutOfBoundsException e) {
		}
		for(int i = 0; i<LONG_LIST_LENGTH; i++ ) {
			assertEquals("Check "+i+ " element", (Integer)i, longerList.get(i));
		}
		try {
			longerList.get(-1);
			fail("Check out of bounds");
		}
		catch (IndexOutOfBoundsException e) {
		}
		try {
			longerList.get(LONG_LIST_LENGTH);
			fail("Check out of bounds");
		}
		catch (IndexOutOfBoundsException e) {
		}
	}
@ Test public void testGet ( ) { try { emptyList . get ( 0 ) ; fail ( "Check out of bounds" ) ; } catch ( IndexOutOfBoundsException e ) { System . out . println ( "got an index out of bound for empty list emptyList.get(0)" ) ; } System . out . println ( " shortList size ...." + shortList . size + " checking first A " + shortList . toString ( ) ) ; assertEquals ( "Check first" , "A" , shortList . get ( 0 ) ) ; System . out . println ( "move on A" ) ; assertEquals ( "Check second" , "B" , shortList . get ( 1 ) ) ; System . out . println ( "move on B" ) ; try { shortList . get ( - 1 ) ; fail ( "Check out of bounds" ) ; } catch ( IndexOutOfBoundsException e ) { System . out . println ( " got an index out of bound for shortList.get(-1).." ) ; } try { shortList . get ( 2 ) ; fail ( "Check out of bounds" ) ; } catch ( IndexOutOfBoundsException e ) { } for ( int i = 0 ; i < LONG_LIST_LENGTH ; i ++ ) { assertEquals ( "Check " + i + " element" , ( Integer ) i , longerList . get ( i ) ) ; } try { longerList . get ( - 1 ) ; fail ( "Check out of bounds" ) ; } catch ( IndexOutOfBoundsException e ) { } try { longerList . get ( LONG_LIST_LENGTH ) ; fail ( "Check out of bounds" ) ; } catch ( IndexOutOfBoundsException e ) { } }
You should not need to add much to this method.
You should not need to add much to this method .
//test empty list, get should throw an exception //			System.out.println(); // test short list, first contents, then out of bounds` // test longer list contents // test off the end of the longer array