@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")); }
public XjcGuavaPluginTest() throws Exception { aPackage = aModel._package("test"); aClass = aPackage._class("AClass"); aSetter = aClass.method(JMod.PUBLIC, aModel.VOID, "setField"); aField = aClass.field(JMod.PRIVATE, aModel.INT, "field"); anotherField = aClass.field(JMod.PRIVATE, aModel.BOOLEAN, "anotherField"); aStaticField = aClass.field(JMod.STATIC | JMod.PUBLIC, aModel.SHORT, "staticField"); aGetter = aClass.method(JMod.PUBLIC, aModel.INT, "getField"); aGetter.body()._return(aField); final JVar setterParam = aSetter.param(aModel.INT, "field"); aSetter.body().assign(aField, setterParam); aSuperClass = aPackage._class("ASuperClass"); aClass._extends(aSuperClass); aSuperClassField = aSuperClass.field(JMod.PRIVATE, aModel.DOUBLE, "superClassField"); }