diff --git a/src/test/java/com/github/danielwegener/xjcguava/XjcGuavaPluginTest.java b/src/test/java/com/github/danielwegener/xjcguava/XjcGuavaPluginTest.java index b1cefd9..0de07e5 100644 --- a/src/test/java/com/github/danielwegener/xjcguava/XjcGuavaPluginTest.java +++ b/src/test/java/com/github/danielwegener/xjcguava/XjcGuavaPluginTest.java @@ -56,14 +56,12 @@ public void testGetSuperclassFields() { assertThat(plugin.getSuperclassFields(aClass), equalTo(Arrays.asList(aSuperClassField))); } - @Test public void testIsStatic() { assertThat(plugin.isStatic(aStaticField), equalTo(true)); assertThat(plugin.isStatic(aField), equalTo(false)); } - @Test public void testGenerateToString() { plugin.generateToStringMethod(aModel,aClass); @@ -72,5 +70,20 @@ public void testGenerateToString() { assertThat(generatedMethod.type().fullName(), equalTo(String.class.getName())); } + @Test + public void testGenerateHashCode() throws ClassNotFoundException { + plugin.generateHashCodeMethod(aModel,aClass); + final JMethod generatedMethod = aClass.getMethod("hashCode", new JType[]{}); + assertThat(generatedMethod, not(nullValue())); + assertThat(generatedMethod.type().fullName(), equalTo("int")); + } + + @Test + public void testGenerateEquals() throws ClassNotFoundException { + plugin.generateEqualsMethod(aModel,aClass); + final JMethod generatedMethod = aClass.getMethod("equals", new JType[]{aModel.parseType("java.lang.Object")}); + assertThat(generatedMethod, not(nullValue())); + assertThat(generatedMethod.type().fullName(), equalTo("boolean")); + } } \ No newline at end of file