I have a class:
public final class Core {
private final Deque<Double> stack = new ArrayDeque<>();
private final HashMap<String, Double> values = new HashMap<>();
public Deque<Double> getStack() {
return stack;
}
public HashMap<String, Double> getValues() {
return values;
}
}
I need a Junit test for this getters, but I don't know how to write it correctly
CodePudding user response:
You get each property and add something to their collection
Then get each property again and verify that what you added is still there
CodePudding user response:
Unit testing setters and getters is excessive. You should be testing methods that actually do something.