Package edu.pdx.cs.joy
Class LRUMapTestCase
java.lang.Object
edu.pdx.cs.joy.LRUMapTestCase
This is a set of JUnit unit tests that test the functionality of an
LRU Map.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract <K,V> AbstractLRUMap <K, V> createLRUMap(int capacity) A factory method that creates a new instance of the LRU Map to be tested.voidTests clearing a mapvoidTests creating a new LRU MapvoidTests that getting an element from a map puts it at the end of the LRU queue.voidTests getting an non-existent entryvoidTests theAbstractLRUMap.getStudentNames()methodsvoidMakes sure that the LRU mapping is removedvoidMakes sure that entrySet() Iterator iteratesvoidTests that the size of the LRU map is boundedvoidAn obscure and amusing edge case.voidTests that removing and element doesn't effect the LRU ordervoidTests removing an non-existent entryvoidThis will accept EITHER an exception being thrown, or the creation of map that never stores data.
-
Constructor Details
-
LRUMapTestCase
public LRUMapTestCase()
-
-
Method Details
-
createLRUMap
A factory method that creates a new instance of the LRU Map to be tested.- Parameters:
capacity- The maximum number of mappings in the newly-created LRU map- Returns:
- A new LRU Map with the given capacity
- Throws:
IllegalArgumentException- A map cannot be created
-
testCreate
Tests creating a new LRU Map- See Also:
-
testGetStudentNames
Tests theAbstractLRUMap.getStudentNames()methods -
testMapSizeIsBounded
Tests that the size of the LRU map is bounded- See Also:
-
testLRUMappingIterates
Makes sure that entrySet() Iterator iterates- See Also:
-
testLRUMappingIsRemoved
Makes sure that the LRU mapping is removed- See Also:
-
testGetFromMap
Tests that getting an element from a map puts it at the end of the LRU queue.- See Also:
-
testGetNonExistent
Tests getting an non-existent entry- See Also:
-
testRemoveFromMap
Tests that removing and element doesn't effect the LRU order- See Also:
-
testRemoveNonExistent
Tests removing an non-existent entry- See Also:
-
testClear
Tests clearing a map- See Also:
-
testNegativeSize
An obscure and amusing edge case. Parent's method signature throws no exception, so this method will accept any exception. -
testZeroSize
This will accept EITHER an exception being thrown, or the creation of map that never stores data.
-