This is probably very easy, but I can't figure out what I'm doing wrong. I'm doing a java file for a junit test already provided for me, as follows
public void testEquals() {
LogicVariable a = new LogicVariable("Y1");
LogicVariable b = new LogicVariable("Y1");
assertTrue(a.equals(b)); // same name
assertTrue(a.equals((Object)b));
}
I got to the point where I have this for my test (have in mind that this code is not for this test only, so I have two constructor with the same name)
public class LogicVariable {
protected String name;
protected boolean value ;
public LogicVariable(String name) {
this.name = name;
}
public LogicVariable(String name, boolean value) {
this.name = name;
this.value = value;
}
As I understand, having more than one constructor with the same name, but different inputs, it automatically chooses the suited one for the arguments given (in this case, skiping the one with the boolean). Am I wrong in thinkin that? I can't figure why are a and b different, given the fact that they're both objects with only their name.
Appreciate your help