SelectOption implements Comparable<SelectOption> { @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final SelectOption other = (SelectOption) obj; if (!Objects.equals(this.text, other.text)) { return false; } return Objects.equals(this.value, other.value); } SelectOption(String value, String text); String getText(); String getValue(); @Override int hashCode(); @Override boolean equals(Object obj); @Override int compareTo(SelectOption other); @Override String toString();  }
@Test public void testNotEqualToNull() { assertThat(instance.equals(null), is(false)); }
@Test public void testNotEqualToOtherClass() { String other = ""; assertThat(instance.equals(other), is(false)); }
@Test public void testNotEqualToOtherOption() { SelectOption other = new SelectOption("wibble", "sass that hoopy frood"); assertThat(instance.equals(other), is(false)); }
@Test public void testIsEqualToOtherOptionWithSameVariables() { SelectOption other = new SelectOption(value, text); assertThat(instance.equals(other), is(true)); }