Skip to content

Commit

Permalink
few more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
danielwegener committed Apr 14, 2016
1 parent 96a8791 commit 135941c
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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"));
}

}

0 comments on commit 135941c

Please sign in to comment.