Package myTest

Class TestSuiteMapAdapter

java.lang.Object
myTest.TestSuiteMapAdapter

public class TestSuiteMapAdapter extends Object
Class TestSuiteMapAdapter

Summary: The test suite TestSuiteMapAdapter provides test on map methods. It offer different type of test in different case scenario, in order to test their corret behaviour. The first section of this test suite contains the test in the TestMap.java file assigned by the Professor, correctly translated in the JUnit format. After this first section there are several section for each methods (or group of feature) contains the test cases ideated by me. The entrySet(), keySet() and values() method and its feature are tested in different dedicated test suite.

Test Suite Design: The test suite contains fine-grained test cases in order to easily individuate errors in HMap methods. This suite include modification test, inspection set and an section dedicated to HEntry method test. In the test suite there are many test cases focusing on limit and special cases, invalid arguments and etc. Each method is tested apart from others.

See Also:
  • Constructor Details

    • TestSuiteMapAdapter

      public TestSuiteMapAdapter()
  • Method Details

    • beforeClassMethod

      public static void beforeClassMethod()
      BeforeClass JUnit static method. Announces the the test begin and starts its timer.
    • beforeMethod

      public void beforeMethod()
      Before JUnit method. It initializes the map used in this suite.
    • afterMethod

      public void afterMethod()
      After JUnit method. It assigns null to m2. It was preferred to not call the clear method as it was target of some test cases, therefore after method cancels any reference to the previous pointed objects, then removed by the Garbage Collector.
    • afterClassMethod

      public static void afterClassMethod()
      AfterClass JUnit static method. Announces the the test end and stops its timer. Prints milliseconds elapsed from the beginning.
    • Propagation_Map_KeySet

      public void Propagation_Map_KeySet()

      Summary:Test the propagation of changes from the map to the keySet. It is tested with adding and removing mappings from the map.

      Test Case Design: Tests that the map correctly propagates the changes of the element in the keySet

      Test Description: The map is initialized with some mappings. Then an entry is removed from the map and after re-added to the map. In each state the size of the map and of the keySet is memorized in specific variables. The last assert simply verify that in each state the size of the map and the size of the keySet match correctly.

      Pre-Condition: The map contains all args elements.

      Post-Condition: The map contains all args elements.

      Expected Results: The map correctly propagates the changes to keySet if the size of the map is equal to the size of the keySet in each state

    • Backing_Map_KeySet

      public void Backing_Map_KeySet()

      Summary:Test the backing of changes from the map to the keySet. It is tested with adding and removing mappings from the keySet.

      Test Case Design: Tests that the keySet correctly backed the changes of the element in the map and vice-versa

      Test Description: The map is initialized with some mappings. Then an entry is removed from the keySet and after re added to the map. In each state the size of the map and of the set is memorized in specific variables. The last assert simply verify that in each state the size of the map and the size of the keySet match correctly

      Pre-Condition: The map contains args elements.

      Post-Condition: The map contains args elements.

      Expected Results: The keySet correctly backed the changes to map if the size of the map is equal to the size of the keySet in each state

    • Emptying_KeySet_Iterator

      public void Emptying_KeySet_Iterator()

      Summary:Test the propagation of changes from the map to the keySet with the iterator.

      Test Case Design: Tests that the map correctly propagates the changes of the element in the keySet using its iterator

      Test Description: The map is initialized with some mappings. Then with the keySet iterator it removes all elements, so that at the end the keySet and the map are emtpy

      Pre-Condition: The map contains args elements.

      Post-Condition: The map is empty.

      Expected Results: The keySet iterator works properly and empty the map and keySet

    • Reset_Map

      public void Reset_Map()

      Summary: Test the clear and put method.

      Test Case Design: Test that clear and put methods works properly

      Test Description: The map is initialized with some mappings. Then its cleared and after is refilled with the initialization mappings and one more element wich is a duplicate

      Pre-Condition:The map contains args elements.

      Post-Condition: The map contains args elements

      Expected Results: The map is unchanged and map put works properly as it not permit duplicate elements.

    • Test_ValuesMethod

      public void Test_ValuesMethod()

      Summary:Test the propagation of changes from the map to the values. It is tested with adding and removing mappings from the map.

      Test Case Design: Tests that the map correctly propagates the changes of the element in the values and vice-versa

      Test Description: The map is initialized with some mappings. Then an entry is removed from the map and after re-added to the map. In each state the size of the map and of the Collection is memorized in specific variables. The last assert simply verify that in each state the size of the map and the size of the values collection match correctly

      Pre-Condition: The map contains args elements.

      Post-Condition: The map contains args elements.

      Expected Results: The map correctly propagates the changes to values if the size of the map is equal to the size of the values collection in each state

    • Emptying_Values_Iterator

      public void Emptying_Values_Iterator()

      Summary:Test the propagation of changes from the map to the values with the iterator.

      Test Case Design: Tests that the map correctly propagates the changes of the element in the values using its iterator

      Test Description: The map is initialized with some mappings. Then with the values iterator it removes all elements, so that at the end the keySet and the map are emtpy

      Pre-Condition: The map contains args elements.

      Post-Condition: The map is empty.

      Expected Results: The values iterator works properly and empty the map and the values collection.

    • Size_Empty_0

      public void Size_Empty_0()

      Summary: size, isEmpty method test case. The test case asserts that an empty map should have a size of zero and isEmpty call returning true. The map is not modified since its creation.

      Test Case Design: The design is a simple assert of a size call and expected 0 size (empty)

      Test Description: size and isEmpty methods are invoked on the map.

      Pre-Condition: The map is empty.

      Post-Condition: The map is still empty.

      Expected Results: The size method returns 0 and the isEmpty method returns true.

    • Size_1Element

      public void Size_1Element()

      Summary: size, isEmpty method test case. The test case asserts that a map with one mapping should have a size of 1 and isEmpty call returning false. The map is modified before the asserts.

      Test Case Design: The design is a simple assert of a size call and expected 1 size and not being empty.

      Test Description: size and isEmpty methods are invoked on the map.

      Pre-Condition: The map is empty.

      Post-Condition: The map contains mapping 1=159 .

      Expected Results: The size method returns 1 and the isEmpty method returns false.

    • Size_5Element

      public void Size_5Element()

      Summary: size, isEmpty method test case. The test case asserts that a map with five mappings should have a size of 5 and isEmpty call returning false. The map is modified before the asserts.

      Test Case Design: The design is a simple assert of a size call and expected 5 size and not being empty.

      Test Description: size and isEmpty methods are invoked on the map.

      Pre-Condition: The map is empty.

      Post-Condition: The map contains five mappings.

      Expected Results: The size method returns 5 and the isEmpty method returns false.

    • Size_160Element

      public void Size_160Element()

      Summary: size, isEmpty method test case. The test case asserts that a map with 160 mappings should have a size of 160 and isEmpty call returning false. The map is modified before the asserts.

      Test Case Design: The design is a simple assert of a size call and expected 160 size and not being empty./p>

      Test Description: size and isEmpty methods are invoked on the map.

      Pre-Condition: The map is empty.

      Post-Condition: The map contains 160 mappings.

      Expected Results: The size method returns 160 and the isEmpty method returns false.

    • Contains_EmptyMapKey

      public void Contains_EmptyMapKey()

      Summary: containsKey method test case.

      Test Case Design: Tests the limit case of invoking the method in an empty map wich should always return false.

      Test Description: key 'ci' is tested to be presente in the map as key.

      Pre-Condition: The map is empty.

      Post-Condition: The map is unchanged, still empty.

      Expected Results: containsKey returns false.

    • Contains_EmptyMapValue

      public void Contains_EmptyMapValue()

      Summary: containsValue method test case.

      Test Case Design: Tests the limit case of invoking the method in an empty map wich should always return false.

      Test Description: value 'ci' is tested to be present in the map as value.

      Pre-Condition: The map is empty.

      Post-Condition: The map is unchanged, still empty.

      Expected Results: containsValue returns false.

    • Contains_1Key_and2

      public void Contains_1Key_and2()

      Summary: containsKey method test case.

      Test Case Design: Test the case of invoking the method before put and after put mappings

      Test Description: 2 keys are tested to be present in the map before and after put the mappings.

      Pre-Condition: The map is empty.

      Post-Condition: The map contains two mappings: "ci"=15 and "ao"=465

      Expected Results: containsKey return false when the mappings are not present, true otherwhise.

    • Contains_1Value_and2

      public void Contains_1Value_and2()

      Summary: containsValue method test case.

      Test Case Design: Test the case of invoking the method before put and after put mappings

      Test Description: 2 values are tested to be present in the map before and after put the mappings.

      Pre-Condition: The map is empty.

      Post-Condition: The map contains two mappings: "ci"=15 and "ao"=465

      Expected Results: containsValue return false when the mappings are not present, true otherwhise.

    • Contains_Key_50to100

      public void Contains_Key_50to100()

      Summary: containsKey method test case.

      Test Case Design: Test the case in wich the method is invoked in a map with medium size.

      Test Description: The map is modified before the asserts. Then it cheks containsKey in different ranges.

      Pre-Condition: The map is empty.

      Post-Condition: The map is not empty

      Expected Results: containsKey return false when the mappings are not present, true otherwhise. The map contains the right key during execution

    • Contains_Value_50to100

      public void Contains_Value_50to100()

      Summary: containsValue method test case.

      Test Case Design: Test the case in wich the method is invoked in a map with medium size.

      Test Description: The map is modified before the asserts. Then it cheks containsValue in different ranges.

      Pre-Condition: The map is empty.

      Post-Condition: The map is not empty

      Expected Results: containsValue return false when the mappings are not present, true otherwhise. The map contains the right value during execution

    • Contains_KeyAndValue_1and3

      public void Contains_KeyAndValue_1and3()

      Summary: containsKey containsValue method test case.

      Test Case Design: Test the case in wich the method is invoked in a map with 3 mappings.

      Test Description: Checks some assert before and after the putting of mappings in the map.

      Pre-Condition:The map is empty.

      Post-Condition: The map contains 3 mappings.

      Expected Results: containsValue and containsKey return false when the mappings are not present, true otherwhise.

    • Contains_NullKey_NPException

      public void Contains_NullKey_NPException()

      Summary: containsKey method test case. Calling the containsKey method with null key in this map should throw NullPointerException runtime exception.

      Test Case Design: The test expects the aforementioned exception to be thrown after a containsKey method invoke with null key.

      Test Description: containsKey method gets called with null key.

      Pre-Condition: Map is empty.

      Post-Condition: Map is empty.

      Expected Results: NullPointerException has been trown.

    • Contains_NullValue_NPException

      public void Contains_NullValue_NPException()

      Summary: containsValue method test case. Calling the containsValue method with null value in this map should throw NullPointerException runtime exception.

      Test Case Design: The test expects the aforementioned exception to be thrown after a containsValue method invoke with null value.

      Test Description: containsValue method gets called with null value.

      Pre-Condition: Map is empty.

      Post-Condition: Map is empty.

      Expected Results: NullPointerException has been trown.

    • Equals_1

      public void Equals_1()

      Summary: equals method test case.

      Test Case Design: equals method is tested with an equal map with the same put calling. The returned values should be true.

      Test Description: Maps are initialized with the putting of one mappings 15=16.4 then equals is invoked.

      Pre-Condition: Maps are empty

      Post-Condition: Maps contains 15=16.4.

      Expected Results: The Maps are equals.

    • Equals_Empty_True

      public void Equals_Empty_True()

      Summary: equals method test case. The test case the method behaviour with 2 empty map.

      Test Case Design: When both maps are empty the equals method should return true because an empty map is equal to an empty map.

      Test Description: Single assert, l1.equals(l2) invoked.

      Pre-Condition: Both maps are empty.

      Post-Condition: Both maps are empty.

      Expected Results: equals returns true, as one empty map of course equals another empty maps.

    • Equals_Reflective

      public void Equals_Reflective()

      Summary: equals method test case. The reflective property of equal method is tested.

      Test Case Design: equals method should be reflective, therefore x.equals(x) should always return true.

      Test Description: The test invokes map1.equals(map1) when map1 is empty, when it has 10 elements and when it has 1000 elements.

      Pre-Condition: Map is not null.

      Post-Condition: map has 1000 elements.

      Expected Results: map equals itself, therefore reflective property is valid.

    • Equals_Transitive

      public void Equals_Transitive()

      Summary: equals method test case. The transitive property of equal method is tested.

      Test Case Design: equals method should be transitive, therefore a.equals(b) and b.equals(c) => a.equals(c).

      Test Description: The test invokes map1.equals(map2) and map2.equals(map3) and map1.equals(map3)

      Pre-Condition: maps contains 30 mappings.

      Post-Condition: maps are unchanged.

      Expected Results: Equals has transitive property.

    • Equals_null

      public void Equals_null()

      Summary: equals method test case.

      Test Case Design: null argumenti. Specific test case.

      Test Description: The test invokes map1.equals(null) and should return always false

      Pre-Condition: The map is empty

      Post-Condition: The map is unchanged.

      Expected Results: Equals return false.

    • Get_Empty

      public void Get_Empty()

      Summary: get method test case.

      Test Case Design: Tests get behaviour when the map is empty, which is a limit case.

      Test Description: get is invoked on an empty map with a key.

      Pre-Condition: Map is empty

      Post-Condition: Map is unchanged

      Expected Results: null is returned

    • Get_1

      public void Get_1()

      Summary: get method test case.

      Test Case Design: Tries to get a value of a key not in the map, then the mappings is put into the map.

      Test Description: get is invoked before and after putting a mappings in the map.

      Pre-Condition: Map contains 15=16.4.

      Post-Condition: Map is empty.

      Expected Results: m.get returns proper values.

    • Get_123

      public void Get_123()

      Summary: get method test case.

      Test Case Design: Tests get behaviour when the map contains 3 mappings.

      Test Description: get is invoked with keys.

      Pre-Condition: m contains 3 mappings

      Post-Condition: m is unchanged

      Expected Results: each get returns in string form.

    • Get_GetNullKey_NPException

      public void Get_GetNullKey_NPException()

      Summary: get method test case. Calling the get method with null key in this map should throw NullPointerException runtime exception.

      Test Case Design: The test expects the aforementioned exception to be thrown after a get method invoke with null key.

      Test Description: get method gets called with null key.

      Pre-Condition: Map is empty.

      Post-Condition: Map is empty.

      Expected Results: NullPointerException has been trown.

    • Get_10000_All

      public void Get_10000_All()

      Summary: get method test case. Test aim is to put in the map 10000 mappings and check if the elements are stored correctly.

      Test Case Design: Test the map with a very large size.

      Test Description: The test put 10000 mappings to the map and then checks every one of them with the get method.

      Pre-Condition: The map is Empty.

      Post-Condition: The map contains 10000 mappings

      Expected Results: Every one of the 10000 mappings matches, therefore get returns each element.

    • Clear_Empty

      public void Clear_Empty()

      Summary: clear method test case.

      Test Case Design: Invokes clear method on an already empty map, which is a limit case.

      Test Description: map is empty. Calls clear on the map, then it should be equal to another empty map.

      Pre-Condition: Map is empty.

      Post-Condition: Map is still empty.

      Expected Results: Map is equal to another empty map. isEmpty return true and size is 0.

    • Clear_1Element

      public void Clear_1Element()

      Summary: clear method test case.

      Test Case Design: Invokes clear method on a map containing 1=1.

      Test Description: Calls clear on the map, then it should be equal to another empty map.

      Pre-Condition: Map contains 1:1.

      Post-Condition: Map is empty.

      Expected Results: Map is equal to another empty map .

    • Clear_0To1000

      public void Clear_0To1000()

      Summary: clear method test case.

      Test Case Design: Invokes clear method on a map containing 1000 mappings.

      Test Description: Calls clear on the map, then it should be equal to another empty map.

      Pre-Condition: Map contains 1000 mappings.

      Post-Condition: Map is empty.

      Expected Results: Map is equal to another empty map.

    • Clear_TwoMaps

      public void Clear_TwoMaps()

      Summary: clear method test case.

      Test Case Design: Invokes clear method on 2 different map. The maps are in various configurations through the test case, and each one is much different from the other. But in the end, after a clear invoke, they must all be empty.

      Test Description: Calls clear on the maps, then they should equal in any case.

      Pre-Condition: map1 and map2 are different.

      Post-Condition: Maps are empty.

      Expected Results: Maps are equal.

    • Put_NullKey_NPException

      public void Put_NullKey_NPException()

      Summary: put method test case. Calling the put method with null key in this map should throw NullPointerException runtime exception.

      Test Case Design: The test expects the aforementioned exception to be thrown after a put method invoke with null key.

      Test Description: put method gets called with null key.

      Pre-Condition: Map is empty.

      Post-Condition: Map is empty.

      Expected Results: NullPointerException has been trown.

    • Put_NullValue_NPException

      public void Put_NullValue_NPException()

      Summary: put method test case. Calling the put method with null value in this map should throw NullPointerException runtime exception.

      Test Case Design: The test expects the aforementioned exception to be thrown after a put method invoke with null value.

      Test Description: put method gets called with null value.

      Pre-Condition: Map is empty.

      Post-Condition: Map is empty.

      Expected Results: NullPointerException has been trown.

    • Put_1Mapping

      public void Put_1Mapping()

      Summary: put method test case. Tests one put invoke.

      Test Case Design: Tests put invoke with an key and value.

      Test Description: put is invoked with key 156 and value "ciao"

      Pre-Condition: Map is empty.

      Post-Condition: Map contains 156="ciao".

      Expected Results: Map contains Key: 156 and value "ciao" and its size is 1.

    • Put_100Mapping

      public void Put_100Mapping()

      Summary: put method test case. Tests 100 put invoke.

      Test Case Design: Tests put with 100 mappings, testing medium input for the map.

      Test Description: put is invoked with key i*i and value i+16 for each iteration.

      Pre-Condition: map is empty.

      Post-Condition: map contains 100 mappings

      Expected Results: map contains each mappings and its size is 100, therefore puts works correctly.

    • Put_OldValue

      public void Put_OldValue()

      Summary: put method test case Test that put method return old value.

      Test Case Design: Tests that put method return the old value associated with a key.

      Test Description: add 1=1 to the map then put 1=2 to the map the method put should return 1

      Pre-Condition:the map contains 1=1

      Post-Condition:the map contain 1=2

      Expected Results: the method put should return 1

    • Remove_EmptyNullKey_NPException

      public void Remove_EmptyNullKey_NPException()

      Summary: remove method test case. Calling the remove method with null key in empty map should throw NullPointerException runtime exception.

      Test Case Design: The test expects the aforementioned exception to be thrown after a remove method invoke with null key.

      Test Description: remove method gets called with null key.

      Pre-Condition: Map is empty.

      Post-Condition: Map is empty.

      Expected Results: NullPointerException has been trown.

    • Remove_NullKey_NPException

      public void Remove_NullKey_NPException()

      Summary: remove method test case. Calling the remove method with null key in this map should throw NullPointerException runtime exception.

      Test Case Design: The test expects the aforementioned exception to be thrown after a remove method invoke with null key.

      Test Description: remove method gets called with null key.

      Pre-Condition: Map contains 450 elements.

      Post-Condition: Map contains 450 elements.

      Expected Results: NullPointerException has been trown.

    • Remove_Empty

      public void Remove_Empty()

      Summary: remove method test case.

      Test Case Design: Tests the remove method in a limit case, which is an empty map, which obviusly does not contain the key.

      Test Description: remove is invoked with 156 key.

      Pre-Condition: Map is empty.

      Post-Condition: Map is unchanged.

      Expected Results: remove returns null

    • Remove_ReturnOldValue

      public void Remove_ReturnOldValue()

      Summary: remove method test case.

      Test Case Design: Tests the remove method feature that returns the old value and after call remove method the map does not contains the key

      Test Description: Put an mappings into the map. Then assert that he remove the 987 values. Then assert that an second remove with the same key return null, because its not present yet.

      Pre-Condition:Map has 44=987 mappings

      Post-Condition: Map is empty.

      Expected Results:remove method works properly

    • Remove_NotPresent

      public void Remove_NotPresent()

      Summary: remove method test case.

      Test Case Design: Tests the remove method in a case where the map does not contain the key.

      Test Description: remove is invoked with 20 key.

      Pre-Condition: Map contains "ciao"="bello".

      Post-Condition: Map is unchanged.

      Expected Results: removes returns null.

    • Remove_450ToEmpty

      public void Remove_450ToEmpty()

      Summary: remove method test case.

      Test Case Design: Removes all the elements through remove method to test its behaviour. Note that the limit case of removing the last element is tested too.

      Test Description: Calls remove 450 times on an map containing 450 mappings, making it empty. Also test that remove methods return the old value

      Pre-Condition: Map contains 450 mappings.

      Post-Condition: Map is empty.

      Expected Results: Map is empty, obviusly its size is 0.

    • PutAll_NullMap_NPException

      public void PutAll_NullMap_NPException()

      Summary: PutAll method test case. Calling PutAll method, which takes a HMap argument, throws an exception.

      Test Case Design: Tests the case with null argument passed, which is a special case of invalid argument.

      Test Description: Calls PutAll with null argument, therefore it throws NullPointerException.

      Pre-Condition: Map is empty.

      Post-Condition: Map is empty.

      Expected Results: NullPointerException has been trown.

    • PutAll_An100ElementsMap

      public void PutAll_An100ElementsMap()

      Summary: putAll method test case.

      Test Case Design: putAll must behave correctly adding a collection of 100 elements, which is a common case for the putAll method.

      Test Description: 100 elements are added in map2 and after map2 is putAll in map1 then the test checks the contained element and its size.

      Pre-Condition: map1 is Empty, map2 contains 100 mappings.

      Post-Condition: map1 and map2 contains 100 mappings.

      Expected Results: map2 contanis 100 mappings.

    • PutAll_EmptyMapInEmptyMap

      public void PutAll_EmptyMapInEmptyMap()

      Summary: putAll method test case.

      Test Case Design: Tests the case of empty map being passed as argument, which is a limit case.

      Test Description: The test cases calls putAll as empty map as argument

      Pre-Condition: Maps are empty

      Post-Condition: Maps are empty

      Expected Results: Maps are still empty

    • PutAll_SameEmptyMap

      public void PutAll_SameEmptyMap()

      Summary: putAll method test case.

      Test Case Design: Tests the case of same empty map being passed as argument, which is a limit case.

      Test Description: The test cases calls putAll as same empty map as argument

      Pre-Condition: Map is empty

      Post-Condition: Map is empty

      Expected Results: Map is still empty

    • PutAll_2TimesPut

      public void PutAll_2TimesPut()

      Summary:putAll method test case. The test adds two times the same map to the map, then checks if the elements were stored correctly.

      Test Case Design: putAll must behave correctly adding two times the same things.

      Test Description: invokes two times the same method with the same map passed as argument

      Pre-Condition: map1 is empty, map2 contains 100 mappings.

      Post-Condition: both maps contains 100 mappings

      Expected Results: map1 contains 100 mappings

    • PutAll_2Maps

      public void PutAll_2Maps()

      Summary:putAll method test case. The test adds two different maps to the same map, then checks if the elements were stored correctly.

      Test Case Design: putAll must behave correctly adding two different maps.

      Test Description: invokes two time the same method with the two different maps passed as argument

      Pre-Condition: map1 is empty, map2 and map3 contains 100-10 mappings.

      Post-Condition: map1 is not empty, map2 and map3 contains 100-10 mappings.

      Expected Results: map1 contains elements from both maps

    • HashCode_Prop

      public void HashCode_Prop()

      Summary: hashCode test case. Tests the behaviour of hashCode method with different configurations.

      Test Case Design: The same operations are applied to map 1 and 2, so they must have the same elements each time, therefore they are equals. If they are equals they must have the same hashCode.

      Test Description: Different configurations have been tested: empty, 1=1, "ciao"=164, 10 mappings

      Pre-Condition: Maps have same hashCode and they are equal.

      Post-Condition: Maps have same hashCode and they are equal.

      Expected Results: Maps have same hashCode and they are equal.

    • Values

      public void Values()

      Summary: values test case

      Test Case Design: values() is an HCollection

      Test Description: checks that values() is an instance of HCollection

      Pre-Condition:Map is empt

      Post-Condition:Map is empty

      Expected Results: values() is an HCollection

    • KeySet

      public void KeySet()

      Summary: keySet test case

      Test Case Design: keySet() is an HSet

      Test Description: checks that keySet() is an instance of HSet

      Pre-Condition:Map is empt

      Post-Condition:Map is empty

      Expected Results: keySet() is an HSet

    • EntrySet

      public void EntrySet()

      Summary: entrySet test case

      Test Case Design: entrySet() is an HSet

      Test Description: checks that entrySet() is an instance of HSet

      Pre-Condition:Map is empt

      Post-Condition:Map is empty

      Expected Results: entrySet() is an HSet

    • ToString_Empty

      public void ToString_Empty()

      Summary: toString method test case.

      Test Case Design: Tests toString method on an empty map.

      Test Description: toString is invoked on a empty map.

      Pre-Condition: map1 is empty.

      Post-Condition: map1 is empty.

      Expected Results: map1.toString returns {}

    • ToString_OneElement

      public void ToString_OneElement()

      Summary: toString method test case.

      Test Case Design: Tests toString method on a map containing 1=Ciaoooo.

      Test Description: toString is invoked on the map.

      Pre-Condition: map1 contains 1=Ciaoooo.

      Post-Condition: map1 still contains 1=Ciaoooo.

      Expected Results: map1.toString returns {1=Ciaoooo}

    • Get_Value

      public void Get_Value()

      Summary: getValue method test case.

      Test Case Design: Test getValue method on an entry containing 15=164

      Test Description: getValue is invoked on an entry

      Pre-Condition: entry me contains 15=164

      Post-Condition: entry me still contains 15=164

      Expected Results: getValue return 164

    • Get_Key

      public void Get_Key()

      Summary: getKey method test case.

      Test Case Design: Test getKey method on an entry containing 999="ciao"

      Test Description: getKey is invoked on an entry

      Pre-Condition: entry me contains 999="ciao"

      Post-Condition: entry me still contains 999="ciao"

      Expected Results: getKey return 999

    • SetValue_Return

      public void SetValue_Return()

      Summary: setValue method test case.

      Test Case Design: Test setValue method on an entry containing 15=164

      Test Description: setValue is invoked on an entry with the new value "ciao" it also check that setValue return the old value

      Pre-Condition: entry me contains 15=164

      Post-Condition: entry me contains 15="ciao"

      Expected Results: setValue work correctly

    • Equals_Empty

      public void Equals_Empty()

      Summary: equals method test case.

      Test Case Design: Test equals method between two entry containing 15 as key

      Test Description: equals method is invoked

      Pre-Condition: entry me1 and me2 contains key 15

      Post-Condition: entry me1 and me2 still contains key 15

      Expected Results: the two entres should be equal

    • Equals_Val1

      public void Equals_Val1()

      Summary: equals method test case.

      Test Case Design: Test equals methon between two entry containing 15 as key

      Test Description: equals method is invoked

      Pre-Condition: entry me1 and me2 contains key 15

      Post-Condition: entry me1 and me2 still contains key 15

      Expected Results: the two entres should be equal

    • HashCode_Entry

      public void HashCode_Entry()

      Summary: hashCode test case. Tests the behaviour of hashCode method

      Test Case Design: The same operations are applied to emtry 1 and 2, so they must have the same elements each time, therefore they are equals. If they are equals they must have the same hashCode.

      Test Description: Configurations have been tested

      Pre-Condition: Maps have same hashCode and they are equal.

      Post-Condition: Maps have same hashCode and they are equal.

      Expected Results: Maps have same hashCode and they are equal.

    • ToString_Entry

      public void ToString_Entry()

      Summary: toString method test case.

      Test Case Design: Tests toString method on two entres.

      Test Description: toString is invoked on the entres

      Pre-Condition: me1 and me2 contains 15=null

      Post-Condition: me1 and me2 contains 15=null

      Expected Results: me1.toString should be equal to me2.toString