SelectionParameters { @Override public int hashCode() { int hash = 3; hash = 97 * hash + (this.qualifyingNames != null ? this.qualifyingNames.hashCode() : 0); hash = 97 * hash + (this.resultType != null ? this.resultType.toString().hashCode() : 0); return hash; } SelectionParameters(List<TypeMirror> qualifiers, List<String> qualifyingNames, TypeMirror resultType,
        Types typeUtils); private  SelectionParameters(List<TypeMirror> qualifiers, List<String> qualifyingNames, TypeMirror resultType,
        Types typeUtils, SourceRHS sourceRHS); static SelectionParameters forInheritance(SelectionParameters selectionParameters); List<TypeMirror> getQualifiers(); List<String> getQualifyingNames(); TypeMirror getResultType(); SourceRHS getSourceRHS(); @Override int hashCode(); @Override boolean equals(Object obj); static SelectionParameters forSourceRHS(SourceRHS sourceRHS);  }
@Test public void testHashCode() { List<String> qualifyingNames = Arrays.asList( "language", "german" ); TypeMirror resultType = new TestTypeMirror( "resultType" ); SelectionParameters params = new SelectionParameters( null, qualifyingNames, resultType, null ); int expectedHash = 3 * 97 + qualifyingNames.hashCode(); expectedHash = 97 * expectedHash + "resultType".hashCode(); assertThat( params.hashCode() ).as( "Expected HashCode" ).isEqualTo( expectedHash ); }
@Test public void testHashCodeWithAllNulls() { SelectionParameters params = new SelectionParameters( null, null, null, null ); assertThat( params.hashCode() ).as( "All nulls hashCode" ).isEqualTo( 3 * 97 * 97 ); }
@Test public void testHashCodeWithNullQualifyingNames() { TypeMirror resultType = new TestTypeMirror( "someType" ); SelectionParameters params = new SelectionParameters( null, null, resultType, null ); assertThat( params.hashCode() ) .as( "QualifyingNames null hashCode" ) .isEqualTo( 3 * 97 * 97 + "someType".hashCode() ); }
@Test public void testHashCodeWithNullResultType() { List<String> qualifyingNames = Collections.singletonList( "mapstruct" ); SelectionParameters params = new SelectionParameters( null, qualifyingNames, null, null ); assertThat( params.hashCode() ) .as( "ResultType nulls hashCode" ) .isEqualTo( ( 3 * 97 + qualifyingNames.hashCode() ) * 97 ); }