@Test public void testHashCodeEqualsContract$null() throws Exception { ImmutableHeader sut = createHeader("header", "value"); assertThat(sut.equals(null),equalTo(false)); }
@Override public boolean equals(Object obj) { boolean result = false; if(obj instanceof Header) { Header that=(Header)obj; result= Objects.equals(this.name,that.name()) && Objects.equals(this.rawValue,that.rawValue()) && Objects.equals(this.elements,that.elements()); } return result; }
ImmutableHeader implements Header { @Override public boolean equals(Object obj) { boolean result = false; if(obj instanceof Header) { Header that=(Header)obj; result= Objects.equals(this.name,that.name()) && Objects.equals(this.rawValue,that.rawValue()) && Objects.equals(this.elements,that.elements()); } return result; } }
ImmutableHeader implements Header { @Override public boolean equals(Object obj) { boolean result = false; if(obj instanceof Header) { Header that=(Header)obj; result= Objects.equals(this.name,that.name()) && Objects.equals(this.rawValue,that.rawValue()) && Objects.equals(this.elements,that.elements()); } return result; } ImmutableHeader(String name, String rawValue, List<ImmutableElement> elements); }
ImmutableHeader implements Header { @Override public boolean equals(Object obj) { boolean result = false; if(obj instanceof Header) { Header that=(Header)obj; result= Objects.equals(this.name,that.name()) && Objects.equals(this.rawValue,that.rawValue()) && Objects.equals(this.elements,that.elements()); } return result; } ImmutableHeader(String name, String rawValue, List<ImmutableElement> elements); @Override String name(); @Override String rawValue(); @Override ImmutableList<Element> elements(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); }
ImmutableHeader implements Header { @Override public boolean equals(Object obj) { boolean result = false; if(obj instanceof Header) { Header that=(Header)obj; result= Objects.equals(this.name,that.name()) && Objects.equals(this.rawValue,that.rawValue()) && Objects.equals(this.elements,that.elements()); } return result; } ImmutableHeader(String name, String rawValue, List<ImmutableElement> elements); @Override String name(); @Override String rawValue(); @Override ImmutableList<Element> elements(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }