I have a Java Object that contains another java object that is a set. For Example:
Public States {
private Set<City> cities = new HashSet(0);
// Setters and Getters Here
}
Public City {
private String dummyValue;
// Setters and Getters Here
}
I would like to test this object to ensure it contains values that I have modified in a method. For example I was trying:
Set<City> citySet = citySetInfoFromAnotherMethod;
assert citySet.iterator().next().equals("Dallas");
However I know this will not work because a Set does not have an order such as a list does.
So in conclusion, in what way can I test this object to see if values another method assigns to it appear after I do something to it.