Package myTest

Class TestSuiteEntrySet

java.lang.Object
myTest.TestSuiteEntrySet

public class TestSuiteEntrySet extends Object
Class TestSuiteEntrySet



Summary: The TestSuiteEntrySet provides test on entrySet set methods. It offer different type of test in differente case scanario, in order to test their correct behaviour. There are several section for each method (or group of feature) contains the test cases ideated by me. Note that all the test contained in the TestSet.java file assigned by the Professor, are just included in this test suite in JUnit format. In the TestSet.java file there are some test with add method (unsupported in entrySet) and some test of the iterator removal, witch are included in the last section of this test suite. Also toString method is tested.

Test Suite Design: This test suite contains fine-grained different test cases for each method of the HSet interface in order to individuate errors in HSet methods Test cases include inspection test, modification test and iterator 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

    • TestSuiteEntrySet

      public TestSuiteEntrySet()
  • 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.
    • Size_Empty

      public void Size_Empty()

      Summary: size, isEmpty method test case. The test case asserts that an empty map should have an empty entrySet set witch should have a size of zero and isEmpty call returning true. The map and the set 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 entrySet set.

      Pre-Condition: The map and the entrySet set is empty.

      Post-Condition: The map and the entrySet set 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 element should have an relative entrySet with one element wich should have 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 entrySet.

      Pre-Condition: The map is empty.

      Post-Condition: The map and set contains entry 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 and its relative entrySetwith 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 set.

      Pre-Condition: The map is empty.

      Post-Condition: The map and the set 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 and its relative entrySet with five 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.

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

      Pre-Condition: The map is empty.

      Post-Condition: The map and the set contains five mappings.

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

    • Contains_Empty

      public void Contains_Empty()

      Summary: contains method test case.

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

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

      Pre-Condition: The map and the set is empty.

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

      Expected Results: contains returns false.

    • Contains_1

      public void Contains_1()

      Summary: contains method test case.

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

      Test Description: an values is tested to be present in the collection before and after put the mappings in the map.

      Pre-Condition: The map and the collection is empty.

      Post-Condition: The map and the collection contains a mapping: "mio"="ci"

      Expected Results: contains return false when the value is not present, true otherwhise.

    • Contains_50to100

      public void Contains_50to100()

      Summary: contains method test case.

      Test Case Design: The test case checks in various situation its internal state with contains.

      Test Description: Numbers from 50 (included) to 100 (excluded) are added, then checks if elements from 25 to 125 are contained in the set in 3 different steps.

      • {25:50} not contained (beginning).
      • {50:100} contained (middle).
      • {100:125} not contained (ending).

      Pre-Condition: The map is empty.

      Post-Condition: The map and the set is not empty.

      Expected Results: The set contains the right elements during execution.

    • Contains_Entry_Null_NPException

      public void Contains_Entry_Null_NPException()

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

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

      Test Description: contains method gets called with null key.

      Pre-Condition: Map and set is empty.

      Post-Condition: Map and set 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. The returned values should be true.

      Test Description: Maps is initialized, then equals invoke are asserted

      Pre-Condition: maps contains 1=1

      Post-Condition: Maps and sets are unchanged.

      Expected Results: The two sets are equal

    • Equals_Empty_True

      public void Equals_Empty_True()

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

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

      Test Description: Single assert, entry1.equals(entry2) invoked.

      Pre-Condition: Both maps and sets are empty.

      Post-Condition: Both sets are empty.

      Expected Results: equals returns true.

    • 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 entry1.equals(entry1) when key is empty, when it has 10 elements and when it has 1000 elements.

      Pre-Condition: The map is empty.

      Post-Condition: The map and the set has 1000 elements.

      Expected Results: The entrySet equals itself

    • 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

      Test Description: The test invokes entry1.equals(entry2) and entry2.equals(key3) and entry1.equals(key3)

      Pre-Condition: The tree maps contains the 30 same mappings

      Post-Condition: The maps and set is unchanged

      Expected Results: Equals has transitive property.

    • Clear_Empty

      public void Clear_Empty()

      Summary: clear method test case.

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

      Test Description: Calls clear on the set, then it should be empty

      Pre-Condition: map and set is empty.

      Post-Condition: maps and set is still empty.

      Expected Results: set is Empty

    • Clear_1Element

      public void Clear_1Element()

      Summary: clear method test case.

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

      Test Description: Calls clear on the set, then it should be empty

      Pre-Condition: The map contains 1=1, the set contains 1

      Post-Condition: The map and set is empty.

      Expected Results: set is Empty

    • Clear_0To1000

      public void Clear_0To1000()

      Summary: clear method test case.

      Test Case Design: Invokes clear method on a set containing {0:1000}.

      Test Description: Calls clear on the set, then it should be empty

      Pre-Condition: The map and the set contains 1000 elements

      Post-Condition: The map and the set is empty.

      Expected Results: set is empty

    • HashCode_Prop_entrySet

      public void HashCode_Prop_entrySet()

      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, and so they must have the same entrySet 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}, {"ciao",0:10}

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

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

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

    • Add_entry

      public void Add_entry()

      Summary: add method test case.

      Test Case Design: The methoud throws UnsupportedOperationException.

      Test Description: add is invoked.

      Pre-Condition: entry1 is empty.

      Post-Condition: entry1 is empty.

      Expected Results: The add method is not supported. UnsupportedOperationException is thrown.

    • AddAll_entry

      public void AddAll_entry()

      Summary: addAll method test case.

      Test Case Design: The methoud throws UnsupportedOperationException.

      Test Description: addAll is invoked.

      Pre-Condition: entry1 is empty.

      Post-Condition: entry1 is empty.

      Expected Results: The addAll method is not supported. UnsupportedOperationException is thrown.

    • Remove_EmptyNullEntry_NPException

      public void Remove_EmptyNullEntry_NPException()

      Summary: remove method test case. Calling the remove method with null key in this entrySet 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 and set is empty.

      Post-Condition: Map and set is empty.

      Expected Results: NullPointerException has been trown.

    • Remove_Null_NPException

      public void Remove_Null_NPException()

      Summary: remove method test case. Calling the remove method with null key in this entrySet 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 and set contains 450 elements.

      Post-Condition: Map and set are unchanged.

      Expected Results: NullPointerException has been trown.

    • Remove_Empty

      public void Remove_Empty()

      Summary: remove method test case. Calling the remove method with a valid key in an empty entrySet should return always false

      Test Case Design: The test invokes remove method on an emtpy set wich is a limit case in wich the remove method should always return false

      Test Description: remove method gets called in an empty set.

      Pre-Condition: Map and set is empty.

      Post-Condition: Map and set is still empty.

      Expected Results: remove method should be return false

    • 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 set does not contains the key

      Test Description: Put an mappings into the map. Then assert that he remove the 44 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 and entrySet has 44

      Post-Condition: Map and Set 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 set does not contain the key.

      Test Description: remove is invoked with 2 different uncontained values.

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

      Post-Condition: Map and set is unchanged.

      Expected Results: removes returns false.

    • 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 set containing 450 elements, making it empty.

      Pre-Condition: Map contains 450 mappings. entrySet contains also 450 elements

      Post-Condition: Map and set is empty.

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

    • RemoveAll_EmptyNull_NPException

      public void RemoveAll_EmptyNull_NPException()

      Summary: removeAll method test case. Calling the removeAll method with null key in this entrySet Set should throw NullPointerException runtime exception.

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

      Test Description: removeAll method gets called with null key.

      Pre-Condition: Map and Set is empty.

      Post-Condition: Map and Set is empty.

      Expected Results: NullPointerException has been trown.

    • RemoveAll_Null_NPException

      public void RemoveAll_Null_NPException()

      Summary: removeAll method test case. Calling the removeAll method with null key in this entrySet Set should throw NullPointerException runtime exception.

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

      Test Description: removeAll method gets called with null key.

      Pre-Condition: Map and Set contains 450 elements.

      Post-Condition: Map and Set are unchanged.

      Expected Results: NullPointerException has been trown.

    • RemoveAll_EmptyArg

      public void RemoveAll_EmptyArg()

      Summary: removeAll method test case.

      Test Case Design: removeAll method called with empty Set as an argument, which is a method's limit case.

      Test Description: The test adds 45 elements to the map then generates the entrySet Set and then calls removeAll with an empty Set. Therefore the maps should be unchanged.

      Pre-Condition: The maps and entry1 contains 45 elements.

      Post-Condition: The maps and entry1 are unchaged.

      Expected Results: The maps are unchanged, therefore removeAll returns false, entry1 is unchanged.

    • RemoveAll_Empty

      public void RemoveAll_Empty()

      Summary: removeAll method test case.

      Test Case Design: removeAll method called in an empty Set with an nonempty Set as argument, which is a method's limit case.

      Test Description: The test adds 45 elements to the map then generates the entrySet Set and then calls removeAll on an empty Set. Therefore the maps should be unchanged.

      Pre-Condition: The maps and entry1 contains 45 elements. entryE is empty

      Post-Condition: The maps and entry1 are unchaged. entryE is empty

      Expected Results: The maps are unchanged, therefore removeAll returns false, entry1 is unchanged. entryE is still empty

    • RemoveAll_10to20Remove100

      public void RemoveAll_10to20Remove100()

      Summary: removeAll method test case.

      Test Case Design: removeAll method called between two Sets. entry2 includes all elements of the entry1

      Test Description: The test adds 100 elements to the map1 and 10 elements to the map2 wich are all in common with map1 then generates the values Set and then calls removeAll with entry2 as argument. Therefore the map1 should be changed and map2 should be unchanged.

      Pre-Condition: The map1 and entry1 contains 100 elements. entry2 contains 10 elements

      Post-Condition: The map1 and entry1 are unchaged. entry2 is unchanged

      Expected Results: The map1 and entry1 are changed, therefore removeAll returns true, entry2 is unchanged.

    • RetainAll_EmptyNull_NPException

      public void RetainAll_EmptyNull_NPException()

      Summary: retainAll method test case. Calling the retainAll method with null key in this entrySet Set should throw NullPointerException runtime exception.

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

      Test Description: retainAll method gets called with null key.

      Pre-Condition: Map and Set is empty.

      Post-Condition: Map and Set is empty.

      Expected Results: NullPointerException has been trown.

    • ReretainAll_Null_NPException

      public void ReretainAll_Null_NPException()

      Summary: retainAll method test case. Calling the retainAll method with null key in this entrySet Set should throw NullPointerException runtime exception.

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

      Test Description: retainAll method gets called with null key.

      Pre-Condition: Map and Set contains 450 elements.

      Post-Condition: Map and Set are unchanged.

      Expected Results: NullPointerException has been trown.

    • RetainAll_EmptySetArg

      public void RetainAll_EmptySetArg()

      Summary: retainAll method test case.

      Test Case Design: retainAll method called with empty Set as an argument, which is a method's limit case.

      Test Description: The test adds 45 elements to the map then generates the entrySet Set and then calls retainAll with an empty Set. Therefore the maps should be changed.

      Pre-Condition: The map and entry1 contains 45 elements. entryE is empty

      Post-Condition: The map and entry1 are chaged. entryE is still empty

      Expected Results: The map and entry1 changed, therefore retainAll returns true, entry1 is changed.

    • RetainAll_Emptykey

      public void RetainAll_Emptykey()

      Summary: retainAll method test case.

      Test Case Design: retainAll method called in an empty Set with an nonempty Set as argument, which is a method's limit case.

      Test Description: The test adds 45 elements to the map then generates the entrySet Set and then calls retainAll on an empty Set. Therefore the maps should be unchanged.

      Pre-Condition: The maps and entry1 contains 45 elements. entryE is empty

      Post-Condition: The maps and entry1 are unchaged. entryE is still empty

      Expected Results: The maps are unchanged, therefore retainAll returns false, entry1 is unchanged.

    • RetainAll_10to20Retain100

      public void RetainAll_10to20Retain100()

      Summary: retainAll method test case.

      Test Case Design: retainAll method called between two Sets. entry2 includes all elements of the entry1

      Test Description: The test adds 100 elements to the map1 and 10 elements to the map2 wich are all in common with map1 then generates the entrySet Set and then calls retainAll with entry2 as argument. Therefore the map1 should be changed and map2 should be unchanged.

      Pre-Condition: The map1 and entry1 contains 100 elements. map2 and entry2 contains 10 elements

      Post-Condition: The map1 and entry1 are chaged. map2 and entry2 is unchanged

      Expected Results: The map1 and entry1 are changed, therefore retainAll returns true, entry2 and map2 is unchanged.

    • ContainsAll_EmptyNull_NPException

      public void ContainsAll_EmptyNull_NPException()

      Summary: containsAll method test case. Calling the containsAll method with null key in this entrySet Set should throw NullPointerException runtime exception.

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

      Test Description: containsAll method gets called with null key.

      Pre-Condition: Map and Set is empty.

      Post-Condition: Map and Set is empty.

      Expected Results: NullPointerException has been trown.

    • ContainsAll_Null_NPException

      public void ContainsAll_Null_NPException()

      Summary: containsAll method test case. Calling the containsAll method with null key in this entrySet Set should throw NullPointerException runtime exception.

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

      Test Description: containsAll method gets called with null key.

      Pre-Condition: Map and Set contains 450 elements.

      Post-Condition: Map and Set are unchanged.

      Expected Results: NullPointerException has been trown.

    • ContainsAll_Empty_False

      public void ContainsAll_Empty_False()

      Summary: containsAll method test case. The method tests if an empty Set contains the elements of another Set, which is obviusly false.

      Test Case Design: The test case tests the limit case of checking an empty Set containing something.

      Test Description: The entry2 contains 45 elements. The containsAll method obviously should return false for any key's content as the Set is empty.

      Pre-Condition: The entry1 is empty. The entry2 contains 45 elements

      Post-Condition: The entryE1 is still empty. The entry2 is unchanged

      Expected Results: The containsAll method return false.

    • ContainsAll_BothEmpty_False

      public void ContainsAll_BothEmpty_False()

      Summary: containsAll method test case. The method tests if an empty Set contains the elements of another Set.

      Test Case Design: The test case tests the limit case of checking an empty Set containing an empty Set, which is true, as the empty subset is the subset of every set, therefore even of the empty set. The tested case is a limit case of containsAll.

      Test Description: The Set is empty. The containsAll method obviously should return true for any key's content, because the empty subset is the subset of every set.

      Pre-Condition: The Sets is empty.

      Post-Condition: The Sets is empty.

      Expected Results: The containsAll method return true.

    • ContainsAll_10to20contains100

      public void ContainsAll_10to20contains100()

      Summary: containsAll method test case.

      Test Case Design: containsAll method called between two Sets. entry2 includes all elements of the entry1

      Test Description: The test adds 100 elements to the map1 and 10 elements to the map2 wich are all in common with map1 then generates the entrySet Set and then calls containsAll with entry2 as argument. Therefore the maps and entrySet should be unchanged.

      Pre-Condition: The map1 and entry1 contains 100 elements. map2 and entry2 contains 10 elements

      Post-Condition: the maps and entrySet should be unchanged.

      Expected Results: the maps and entrySet should be unchanged. containsAll should return true as entry1 contains entry2 elements.

    • ContainsAll_10Notcontains100

      public void ContainsAll_10Notcontains100()

      Summary: containsAll method test case.

      Test Case Design: containsAll method called between two Sets. entry2 includes elements different from the elements of the entry1

      Test Description: The test adds 100 elements to the map1 and 10 elements to the map2 wich are not in common with map1 then generates the entrySet Set and then calls containsAll with entry2 as argument. Therefore the maps and entrySet should be unchanged.

      Pre-Condition: The map1 and entry1 contains 100 elements. map2 and entry2 contains 10 elements not present in entry1

      Post-Condition: the maps and entrySet should be unchanged.

      Expected Results: the maps and entrySet should be unchanged. containsAll should return false as entry1 not contains entry2 elements.

    • ToArray_Empty_EmptyArray

      public void ToArray_Empty_EmptyArray()

      Summary: toArray method test case. The test case asserts that an empty set should return an empty array on a toArray call. The set is not modified since its creation.

      Test Case Design: Tests the limit case of a toArray call returning an empty array. From the Sommerville: "Test with sequences of zero lenght."

      Test Description: Test based on the trivial but possible state of an empty set.

      Pre-Condition: The set is empty.

      Post-Condition: The set is still empty.

      Expected Results: The toArray method returns an empty array and therefore its lenght is 0.

    • ToArray_1_True

      public void ToArray_1_True()

      Summary: toArray method test case.

      Test Case Design: Test the toArray method when the set and the map contains only one element then checks if the set element matches the inserted elements.

      Test Description: Inserts 1=1 to the map. Then assertArrayEquals is called.

      Pre-Condition: The set and map is empty.

      Post-Condition: The set and map contains 1 element.

      Expected Results: entry1.toArray() returns [1].

    • ToArray_ArrayDest_1

      public void ToArray_ArrayDest_1()

      Summary: toArray test case. The test adds one element to the map and then call toArray method on the entrySet.

      Test Case Design: Test focuses on toArray behaviour when it has only one element, which is a limit case.

      Test Description: Adds one to the set, calls toArray method and checks the array's first element and its size.

      Pre-Condition: The set is empty.

      Post-Condition: The set has one element {145}.

      Expected Results: The element is stored correctly in the array returned from the method (the array is [1]) and its size is 1.

    • ToArray_DestNull_NPException

      public void ToArray_DestNull_NPException()

      Summary: toArray(HSet) method test case.

      Test Case Design: The test checks the method behaviour when the argument is null, which a special case.

      Test Description: If the specified array is null excpetion is being thrown.

      Pre-Condition: The set is empty

      Post-Condition: The set is still empty.

      Expected Results: NullPointerExceptio is thrown.

    • ToArray_DestSmaller

      public void ToArray_DestSmaller()

      Summary: toArray(HSet) method test case. The set has 2 elements and checks the array.

      Test Case Design: The test checks the method behaviour when the argument size is not enough for containing the set's elements, which a special case.

      Test Description: arr contains the result of toArray method, but exception is being thrown.

      Pre-Condition: The set has 2 elements, arr is empty.

      Post-Condition: The set has 2 elements, arr is still empty.

      Expected Results: HIllegalArgumentException is thrown.

    • ToString_Empty

      public void ToString_Empty()

      Summary: toString method test case.

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

      Test Description: toString is invoked on a empty set.

      Pre-Condition: map1 and key are empty.

      Post-Condition: map1 and key are empty.

      Expected Results: key.toString return []

    • ToString_OneElement

      public void ToString_OneElement()

      Summary: toString method test case.

      Test Case Design: Tests toString method on a map containing 1=1 so that entry set contains 1=1

      Test Description: toString is invoked on the set.

      Pre-Condition: map1 contains 1=1.

      Post-Condition: map1 contains 1=1.

      Expected Results: key.toString [1=1]

    • Backed_ClearPut

      public void Backed_ClearPut()

      Summary: backing clear and put test case. Test the correct propagation entrySet to map and viceversa by using the clear method on the map and on the set and the put method on the map

      Test Case Design: Using some assertion it test the backing of contents in the map and the set before and after some put call and clear call.

      Test Description: Test the backing of contents in the map and the set before and after some put call and clear call.

      Pre-Condition: map and entrySet is empty.

      Post-Condition: map and entrySet is empty.

      Expected Results: put and clear should add and remove elements from both side.

    • Backed_putAllRemove

      public void Backed_putAllRemove()

      Summary: backing putall and remove test case. Test the correct propagation entrySet to map and viceversa by using the remove method on the map and on the set and the putall method on the map

      Test Case Design: Using some assertion it test the backing of contents in the map and the set before and after some putall call and remove call.

      Test Description: Test the backing of contents in the map and the set before and after some putall call and remove call.

      Pre-Condition: map and entrySet is empty.

      Post-Condition: map and entrySet is empty.

      Expected Results: putall and remove should add and remove elements from both side.

    • Backed_PutRemove

      public void Backed_PutRemove()

      Summary: backing put and remove test case. Test the correct propagation values to map and viceversa by using the remove method on the map and on the set and the put method on the map

      Test Case Design: Using some assertion it test the backing of contents in the map and the set before and after some put call and remove call.

      Test Description: Test the backing of contents in the map and the set before and after some put call and remove call.

      Pre-Condition: map and entrySet is empty.

      Post-Condition: map and entrySet is empty.

      Expected Results: put and remove should add and remove elements from both side.

    • Backed_IteratorRemove

      public void Backed_IteratorRemove()

      Summary: backing remove with iterator test case. Test the correct propagation from entrySet to map and viceversa by using the remove method of iterator

      Test Case Design: Tests the iterator's remove method in a set with 1000 elements util iterator has next element

      Test Description: it invoke next and then remove until the iterator has the next element. Once he had finished the iterator clear all the set. So the map and the set is emtpy

      Pre-Condition: map1 and entrySet has 1000 elements

      Post-Condition: map1 and entrySet are empty

      Expected Results: map1 and entrySet are empty, so the iterator correctly remove all elements

    • Backed_removeAll

      public void Backed_removeAll()

      Summary: backing removeAll test case. Test the propagation from entrySet to map and viceversa.

      Test Case Design:Tests removeAll method with entrySet HSet. Correct propagation is tested in both ways.

      Test Description: map1 contains 50 mappings, and entry1 as consequence contains 50 elements. map2 contains only 5 mappings in 20-25 range. After call removeAll all the elements in common between entry1 and entry2 will be removed.

      Pre-Condition:map1 contains 50 mappings, entry1 contains 50 values, map2 contains 5 mappings and entry2 contains 5 values

      Post-Condition: map2 and entry2 are unchanged. map1 and entry1 contains less elements.

      Expected Results: the removeAll method correctly propagate the changes. Also removeAll method remove the elements in common between entry1 and entry2

    • Backed_retainAll

      public void Backed_retainAll()

      Summary: baking retainAll test case. Test the propagation from entrySet to map and viceversa.

      Test Case Design:Tests retainAll method with entrySet HSet. Correct propagation is tested in both ways.

      Test Description: map1 contains 50 mappings, and entry1 as consequence contains 50 elements. map2 contains only 5 mappings in 20-25 range. After call retainAll all the elements in common between entry1 and entry2 will retain.

      Pre-Condition:map1 contains 50 mappings, entry1 contains 50 values, map2 contains 5 mappings and entry2 contains 5 values

      Post-Condition: map2 and entry2 are unchanged. map1 and entry1 contains less elements.

      Expected Results: the retainAll method correctly propagate the changes. Also retainAll method retain the elements in common between entry1 and entry2

    • Iterator_HasNext_Emtpy

      public void Iterator_HasNext_Emtpy()

      Summary: hasNext and next methods test case.

      Test Case Design: Tests the limit case of an iterator returned from an empty set calling hasNext and next.

      Test Description: an iterator is returned from empty set. iterator.hasNext() should be false, while next() should throw NoSuchElementException.

      Pre-Condition: The set is empty.

      Post-Condition: The set is still empty.

      Expected Results: hasNext returns false, NSEE is thrown.

    • Iterator_HasNext_Begin1_True

      public void Iterator_HasNext_Begin1_True()

      Summary: hasNext and next methods test case. set contains 1 element and the test iterate through it.

      Test Case Design: Tests the limit case of 1 element in the set. Therefore hasNext should return true while next() should return the only number in the set.

      Test Description: The number 1 is added, and an iterator iterates through the set. After returning the first elements, it has no more next elements.

      Pre-Condition: set contains 1, iterator has next.

      Post-Condition: set contains 1, iterator has not next.

      Expected Results: The first hasNext call returns true, the second returns false.

    • Iterator_Next_1

      public void Iterator_Next_1()

      Summary:iterator next method test case

      Test Case Design: Tests that next method return the correct elements

      Test Description: Simply call next method on an set contains 1 elements

      Pre-Condition:map and set contains 1 elements

      Post-Condition: map and set are unchanged

      Expected Results: next return 1 and hasnext is false

    • Iterator_Remove_Empty_HISE

      public void Iterator_Remove_Empty_HISE()

      Summary: remove method test case. Test should throw an exception.

      Test Case Design: Tests if for a set a remove method throws IllegalStateException on an emtpy set

      Test Description: remove is invoked by an iterator instance on an emtpy set.

      Pre-Condition: set is emtpy.

      Post-Condition: set is emtpy.

      Expected Results: HIllegalStateException thrown.

    • Remove_OneElement_HISE

      public void Remove_OneElement_HISE()

      Summary: remove method test case. Test should throw an exception.

      Test Case Design: Tests if for a set a remove method throws HIllegalStateException, as no prev or next has been called, or remove or add have been called after the last call to next or previous

      Test Description: remove is invoked by an iterator instance.

      Pre-Condition: set has 1 element.

      Post-Condition: set still has 1 element.

      Expected Results: HIllegalStateException thrown.