DebuggerVariable { @Override public boolean equals(Object object) { if (object == this) { return true; } if (object == null || object.getClass() != this.getClass()) { return false; } DebuggerVariable var = (DebuggerVariable)object; return this.getName().equals(var.getName()) && this.getValue().equals(var.getValue()) && this.getVariablePath().equals(var.getVariablePath()); } DebuggerVariable(@NotNull Variable variable); @NotNull Variable getVariable(); @NotNull String getName(); void setName(@NotNull String name); @NotNull String getValue(); void setValue(@NotNull String value); @NotNull String getType(); void setType(@NotNull String type); @NotNull VariablePath getVariablePath(); boolean isPrimitive(); @NotNull List<DebuggerVariable> getVariables(); void setVariables(@NotNull List<DebuggerVariable> debuggerVariables); @Override int hashCode(); @Override boolean equals(Object object);  }
@Test public void objectShouldNotBeEqualsWhenObjectIsNull() { boolean isEquals = debuggerVariable.equals(nullValue()); assertThat(isEquals, is(false)); }
@Test public void objectShouldNotBeEqualsWhenObjectIsOtherClass() { DebuggerView testObject = mock(DebuggerView.class); boolean isEquals = debuggerVariable.equals(testObject); assertThat(isEquals, is(false)); }
@Test public void objectShouldBeEqualsWhenObjectsHaveSameReference() { boolean isEquals = debuggerVariable.equals(debuggerVariable); assertThat(isEquals, is(true)); }