@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 testGenerateToString() { plugin.generateToStringMethod(aModel, aClass); final JMethod generatedMethod = aClass.getMethod("toString", new JType[0]); assertThat(generatedMethod, not(nullValue())); assertThat(generatedMethod.type().fullName(), equalTo(String.class.getName())); }
@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")); }