+ @Test
+ public void builderTemplateGenerateHashcodeWithPropertyTest() {
+ final GeneratedType genType = mockGenType("get" + TEST);
+
+ assertXtendEquals("/**\n"
+ + " * Default implementation of {@link Object#hashCode()} contract for this interface.\n"
+ + " * Implementations of this interface are encouraged to defer to this method to get consistent"
+ + " hashing\n"
+ + " * results across all implementations.\n"
+ + " *\n"
+ + " * @param obj Object for which to generate hashCode() result.\n"
+ + " * @return Hash code value of data modeled by this interface.\n"
+ + " * @throws NullPointerException if {@code obj} is null\n"
+ + " */\n"
+ + "static int bindingHashCode(final test.@NonNull test obj) {\n"
+ + " final int prime = 31;\n"
+ + " int result = 1;\n"
+ + " result = prime * result + Objects.hashCode(obj.getTest());\n"
+ + " return result;\n"
+ + "}\n", genHashCode(genType).toString());
+ }
+
+ @Test
+ public void builderTemplateGenerateHashCodeWithoutAnyPropertyTest() throws Exception {
+ assertEquals("", genHashCode(mockGenType(TEST)).toString());
+ }
+
+ @Test
+ public void builderTemplateGenerateHashCodeWithMorePropertiesTest() throws Exception {
+ assertXtendEquals("/**\n"
+ + " * Default implementation of {@link Object#hashCode()} contract for this interface.\n"
+ + " * Implementations of this interface are encouraged to defer to this method to get consistent"
+ + " hashing\n"
+ + " * results across all implementations.\n"
+ + " *\n"
+ + " * @param obj Object for which to generate hashCode() result.\n"
+ + " * @return Hash code value of data modeled by this interface.\n"
+ + " * @throws NullPointerException if {@code obj} is null\n"
+ + " */\n"
+ + "static int bindingHashCode(final test.@NonNull test obj) {\n"
+ + " final int prime = 31;\n"
+ + " int result = 1;\n"
+ + " result = prime * result + Objects.hashCode(obj.getTest1());\n"
+ + " result = prime * result + Objects.hashCode(obj.getTest2());\n"
+ + " return result;\n"
+ + "}\n", genHashCode(mockGenTypeMoreMeth("get" + TEST)).toString());
+ }
+
+ @Test
+ public void builderTemplateGenerateHashCodeWithoutPropertyWithAugmentTest() throws Exception {
+ assertXtendEquals("/**\n"
+ + " * Default implementation of {@link Object#hashCode()} contract for this interface.\n"
+ + " * Implementations of this interface are encouraged to defer to this method to get consistent"
+ + " hashing\n"
+ + " * results across all implementations.\n"
+ + " *\n"
+ + " * @param obj Object for which to generate hashCode() result.\n"
+ + " * @return Hash code value of data modeled by this interface.\n"
+ + " * @throws NullPointerException if {@code obj} is null\n"
+ + " */\n"
+ + "static int bindingHashCode(final test.@NonNull test obj) {\n"
+ + " final int prime = 31;\n"
+ + " int result = 1;\n"
+ + " for (var augmentation : obj.augmentations().values()) {\n"
+ + " result += augmentation.hashCode();\n"
+ + " }\n"
+ + " return result;\n"
+ + "}\n", genHashCode(mockAugment(mockGenType(TEST))).toString());
+ }
+
+ @Test
+ public void builderTemplateGenerateHashCodeWithPropertyWithAugmentTest() throws Exception {
+ assertXtendEquals("/**\n"
+ + " * Default implementation of {@link Object#hashCode()} contract for this interface.\n"
+ + " * Implementations of this interface are encouraged to defer to this method to get consistent"
+ + " hashing\n"
+ + " * results across all implementations.\n"
+ + " *\n"
+ + " * @param obj Object for which to generate hashCode() result.\n"
+ + " * @return Hash code value of data modeled by this interface.\n"
+ + " * @throws NullPointerException if {@code obj} is null\n"
+ + " */\n"
+ + "static int bindingHashCode(final test.@NonNull test obj) {\n"
+ + " final int prime = 31;\n"
+ + " int result = 1;\n"
+ + " result = prime * result + Objects.hashCode(obj.getTest());\n"
+ + " for (var augmentation : obj.augmentations().values()) {\n"
+ + " result += augmentation.hashCode();\n"
+ + " }\n"
+ + " return result;\n"
+ + "}\n", genHashCode(mockAugment(mockGenType("get" + TEST))).toString());
+ }
+
+ @Test
+ public void builderTemplateGenerateHashCodeWithMorePropertiesWithAugmentTest() throws Exception {
+ assertXtendEquals("/**\n"
+ + " * Default implementation of {@link Object#hashCode()} contract for this interface.\n"
+ + " * Implementations of this interface are encouraged to defer to this method to get consistent"
+ + " hashing\n"
+ + " * results across all implementations.\n"
+ + " *\n"
+ + " * @param obj Object for which to generate hashCode() result.\n"
+ + " * @return Hash code value of data modeled by this interface.\n"
+ + " * @throws NullPointerException if {@code obj} is null\n"
+ + " */\n"
+ + "static int bindingHashCode(final test.@NonNull test obj) {\n"
+ + " final int prime = 31;\n"
+ + " int result = 1;\n"
+ + " result = prime * result + Objects.hashCode(obj.getTest1());\n"
+ + " result = prime * result + Objects.hashCode(obj.getTest2());\n"
+ + " for (var augmentation : obj.augmentations().values()) {\n"
+ + " result += augmentation.hashCode();\n"
+ + " }\n"
+ + " return result;\n"
+ + "}\n", genHashCode(mockAugment(mockGenTypeMoreMeth("get" + TEST))).toString());
+ }
+