Author: kmorin Date: 2009-07-28 12:02:01 +0200 (Tue, 28 Jul 2009) New Revision: 1533 Added: trunk/guix-compiler-gwt/src/test/java/org/nuiton/guix/generator/ trunk/guix-compiler-gwt/src/test/java/org/nuiton/guix/generator/GwtGeneratorTest.java Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtGenerator.java trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtJavaFileGenerator.java trunk/guix-compiler-gwt/src/test/java/org/nuiton/guix/GwtEventHandlerTest.java Log: add not null conditions + tests for the binding generation Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtGenerator.java =================================================================== --- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtGenerator.java 2009-07-27 12:37:53 UTC (rev 1532) +++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtGenerator.java 2009-07-28 10:02:01 UTC (rev 1533) @@ -49,95 +49,99 @@ @Override public JavaFile generate() { - String gmoClassName = gmo.getClassDescriptor().getName(); - File outDir = new File(destDir, "client"); - if (!outDir.exists()) { - outDir.mkdir(); - } - File out = new File(outDir, gmoClassName + ".java"); - File outAbstract = new File(outDir, gmoClassName + "Abstract.java"); - File outImpl = new File(outDir, gmoClassName + "Impl.java"); + try { + String gmoClassName = gmo.getClassDescriptor().getName(); + File outDir = new File(destDir, "client"); + if (!outDir.exists()) { + outDir.mkdir(); + } + File out = new File(outDir, gmoClassName + ".java"); + File outAbstract = new File(outDir, gmoClassName + "Abstract.java"); + File outImpl = new File(outDir, gmoClassName + "Impl.java"); - if (lastModification > out.lastModified()) { - try { - if (log.isInfoEnabled()) { - log.info("Generation of " + gmo.getClassDescriptor().getName()); - } - if (!out.exists()) { - try { - out.createNewFile(); - outAbstract.createNewFile(); - outImpl.createNewFile(); + if (lastModification > out.lastModified()) { + try { + if (log.isInfoEnabled()) { + log.info("Generation of " + gmo.getClassDescriptor().getName()); } - catch (IOException ex) { - log.error(ex); + if (!out.exists()) { + try { + out.createNewFile(); + outAbstract.createNewFile(); + outImpl.createNewFile(); + } + catch (IOException ex) { + log.error(ex); + } } - } - GwtInterfaceGenerator ging = new GwtInterfaceGenerator(gmo, classes); - GwtAbstractClassGenerator gacg = new GwtAbstractClassGenerator(gmo, classes); - GwtImplementationGenerator gimg = new GwtImplementationGenerator(gmo, classes); + GwtInterfaceGenerator ging = new GwtInterfaceGenerator(gmo, classes); + GwtAbstractClassGenerator gacg = new GwtAbstractClassGenerator(gmo, classes); + GwtImplementationGenerator gimg = new GwtImplementationGenerator(gmo, classes); - if (mainClass) { - gimg.addMainMethod(); - GwtConfigGenerator gcg = new GwtConfigGenerator(gmo, getCSSFiles()); - GwtHtmlGenerator ghg = new GwtHtmlGenerator(gmo, launcherName); - File outConfigMain = new File(destDir, launcherName.substring(launcherName.lastIndexOf('.') + 1) + ".gwt.xml"); - File publicDir = new File(destDir, "public"); - if (!publicDir.exists()) { - publicDir.mkdir(); - } - File outHtmlMain = new File(publicDir, launcherName.substring(launcherName.lastIndexOf('.') + 1) + ".html"); - gcg.generate(outConfigMain); - for(File f : getCSSFiles()) { - try { - File fPublic = new File(publicDir, f.getName()); - fPublic.createNewFile(); - FileInputStream fis = new FileInputStream(f); - FileOutputStream fos = new FileOutputStream(fPublic); - // segment size : 0.5Mo - byte buffer[] = new byte[512*1024]; - int read; - while((read = fis.read(buffer)) != -1) { - fos.write(buffer, 0, read); + if (mainClass) { + gimg.addMainMethod(); + GwtConfigGenerator gcg = new GwtConfigGenerator(gmo, getCSSFiles()); + GwtHtmlGenerator ghg = new GwtHtmlGenerator(gmo, launcherName); + File outConfigMain = new File(destDir, launcherName.substring(launcherName.lastIndexOf('.') + 1) + ".gwt.xml"); + File publicDir = new File(destDir, "public"); + if (!publicDir.exists()) { + publicDir.mkdir(); + } + File outHtmlMain = new File(publicDir, launcherName.substring(launcherName.lastIndexOf('.') + 1) + ".html"); + gcg.generate(outConfigMain); + for(File f : getCSSFiles()) { + try { + File fPublic = new File(publicDir, f.getName()); + fPublic.createNewFile(); + FileInputStream fis = new FileInputStream(f); + FileOutputStream fos = new FileOutputStream(fPublic); + // segment size : 0.5Mo + byte buffer[] = new byte[512*1024]; + int read; + while((read = fis.read(buffer)) != -1) { + fos.write(buffer, 0, read); + } + fis.close(); + fos.close(); } - fis.close(); - fos.close(); + catch(IOException eee) { + log.error(eee); + } } - catch(IOException eee) { - log.error(eee); - } + ghg.generate(outHtmlMain); } - ghg.generate(outHtmlMain); - } - ging.generate(); - generators.put(ging, out); - JavaFile jf = gacg.generate(); - generators.put(gacg, outAbstract); - gimg.generate(); - generators.put(gimg, outImpl); + ging.generate(); + generators.put(ging, out); + JavaFile jf = gacg.generate(); + generators.put(gacg, outAbstract); + gimg.generate(); + generators.put(gimg, outImpl); - serializer.startTag("", "bean"); - serializer.attribute("", "id", gmoClassName.replace(out.getName().charAt(0), - Character.toLowerCase(out.getName().charAt(0)))).attribute("", "class", gmoClassName + "Impl").attribute("", "singleton", "false").endTag("", "bean"); - setBindingsToGenerate(gacg.getBindings2Generate()); + serializer.startTag("", "bean"); + serializer.attribute("", "id", gmoClassName.replace(out.getName().charAt(0), + Character.toLowerCase(out.getName().charAt(0)))).attribute("", "class", gmoClassName + "Impl").attribute("", "singleton", "false").endTag("", "bean"); + setBindingsToGenerate(gacg.getBindings2Generate()); - return jf; + return jf; + } + catch (IllegalArgumentException ex) { + log.error(ex); + } + catch (IllegalStateException ex) { + log.error(ex); + } + catch (IOException ex) { + log.error(ex); + } } - catch (IllegalArgumentException ex) { - log.error(ex); + else if (log.isWarnEnabled()) { + log.warn(gmo.getClassDescriptor().getName() + " has already been generated and is up to date."); } - catch (IllegalStateException ex) { - log.error(ex); - } - catch (IOException ex) { - log.error(ex); - } } - else if (log.isWarnEnabled()) { - log.warn(gmo.getClassDescriptor().getName() + " has already been generated and is up to date."); + finally { + return null; } - return null; } @Override @@ -150,6 +154,11 @@ @Override public List<Class> generateBindings(StringBuffer dbCreation, StringBuffer dbDeletion, TagHandler prevTh, JavaFile jf, Class clazz, String[] binding, int i, List<String> alreadyChecked, String methodToInvoke, Map<GuixGenerator, JavaFile> generatedFiles) { + if(dbCreation == null || dbDeletion == null || binding == null || (jf == null && clazz ==null) + || methodToInvoke == null || generatedFiles == null || i < 0) { + return null; + } + //does the attribute or method to bind exists ? boolean bindingExists = false; //the return type of the binding @@ -399,6 +408,9 @@ return generateBindings(dbCreation, dbDeletion, th, nextFile, nextClazz, binding, i + 1, alreadyChecked, methodToInvoke, generatedFiles); } else { + if(listener == null) { + return null; + } result.add(listener); return result; } Modified: trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtJavaFileGenerator.java =================================================================== --- trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtJavaFileGenerator.java 2009-07-27 12:37:53 UTC (rev 1532) +++ trunk/guix-compiler-gwt/src/main/java/org/nuiton/guix/generator/GwtJavaFileGenerator.java 2009-07-28 10:02:01 UTC (rev 1533) @@ -44,6 +44,9 @@ * @param gmo GuixModelObject which represents the class to generate */ protected void addImports(GuixModelObject gmo) { + if(gmo == null) { + return; + } for (GuixModelObject child : gmo.getChildren()) { if (child.getClassDescriptor().getPackageName() == null && TagManager.getGuixClassHandler(child.getClassDescriptor().getName()) != null) { Modified: trunk/guix-compiler-gwt/src/test/java/org/nuiton/guix/GwtEventHandlerTest.java =================================================================== --- trunk/guix-compiler-gwt/src/test/java/org/nuiton/guix/GwtEventHandlerTest.java 2009-07-27 12:37:53 UTC (rev 1532) +++ trunk/guix-compiler-gwt/src/test/java/org/nuiton/guix/GwtEventHandlerTest.java 2009-07-28 10:02:01 UTC (rev 1533) @@ -36,6 +36,7 @@ */ public class GwtEventHandlerTest { + /** log */ Log log = LogFactory.getLog(GwtEventHandlerTest.class); /** @@ -45,11 +46,15 @@ public void testAddEvent() { GwtEventHandler geh = new GwtEventHandler(); try { + //null parameters return false assertFalse(geh.addEvent(null, "", "")); assertFalse(geh.addEvent(Widget.class, null, "")); assertFalse(geh.addEvent(Widget.class, "", null)); + //tests a basic adding assertTrue(geh.addEvent(FocusWidget.class, "onClick", "test1")); + //tests the adding of some different code for the same event assertTrue(geh.addEvent(FocusWidget.class, "onClick", "test2")); + //tests an unknown event assertFalse(geh.addEvent(FocusWidget.class, "azerty", "")); } catch (IntrospectionException eee) { @@ -64,12 +69,21 @@ */ @Test public void testGenerate() { - GwtEventHandler seh = new GwtEventHandler(); + GwtEventHandler geh = new GwtEventHandler(); try { - assertNotNull(seh.generate("")); - assertEquals(seh.generate(""), ""); - seh.addEvent(FocusWidget.class, "onClick", ""); - assertTrue(seh.generate("").length() > 0); + //tests a basic generation without any added event + assertNotNull(geh.generate("object")); + assertNotNull(geh.generate("")); + assertNotNull(geh.generate(null)); + assertEquals(geh.generate("object"), ""); + assertEquals(geh.generate(""), ""); + assertEquals(geh.generate(null), ""); + //adds an event + geh.addEvent(FocusWidget.class, "onClick", "test"); + //tests that something is generated + assertTrue(geh.generate("object").length() > 0); + assertTrue(geh.generate("").length() > 0); + assertTrue(geh.generate(null).length() > 0); } catch (IntrospectionException eee) { if(log.isErrorEnabled()) { Added: trunk/guix-compiler-gwt/src/test/java/org/nuiton/guix/generator/GwtGeneratorTest.java =================================================================== --- trunk/guix-compiler-gwt/src/test/java/org/nuiton/guix/generator/GwtGeneratorTest.java (rev 0) +++ trunk/guix-compiler-gwt/src/test/java/org/nuiton/guix/generator/GwtGeneratorTest.java 2009-07-28 10:02:01 UTC (rev 1533) @@ -0,0 +1,134 @@ +/** + * *##% guix-compiler-gwt + * Copyright (C) 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* + */ +package org.nuiton.guix.generator; + +import org.nuiton.guix.*; +import com.google.gwt.user.client.ui.ClickListener; +import com.google.gwt.user.client.ui.ToggleButton; +import java.lang.reflect.Modifier; +import java.util.HashMap; +import java.util.Map; +import org.junit.Test; +import org.nuiton.guix.generator.GwtGenerator; +import org.junit.Assert; +import org.nuiton.guix.generator.GuixGenerator; +import org.nuiton.guix.generator.JavaField; +import org.nuiton.guix.generator.JavaFile; +import org.nuiton.guix.generator.JavaMethod; +import org.nuiton.guix.tags.gwt.ToggleButtonHandler; + +/** + * Tests the methods of the GwtGenerator class + * + * @author kmorin + */ +public class GwtGeneratorTest { + + @Test + public void testGenerate() { + GwtGenerator gg = new GwtGenerator(); + Assert.assertNull(gg.generate()); + } + + @Test + public void testGenerateBinding() { + GwtGuixInitializer.initialize(); + GwtGenerator gg = new GwtGenerator(); + //tests the not null condition for the parameters that needs to be not null + Assert.assertNull(gg.generateBindings(null, new StringBuffer(), null, null, Class.class, new String[0], 0, null, "", new HashMap<GuixGenerator, JavaFile>())); + Assert.assertNull(gg.generateBindings(new StringBuffer(), null, null, null, Class.class, new String[0], 0, null, "", new HashMap<GuixGenerator, JavaFile>())); + Assert.assertNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, null, Class.class, null, 0, null, "", new HashMap<GuixGenerator, JavaFile>())); + Assert.assertNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, null, Class.class, new String[0], -1, null, "", new HashMap<GuixGenerator, JavaFile>())); + Assert.assertNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, null, Class.class, new String[0], -1, null, "", new HashMap<GuixGenerator, JavaFile>())); + Assert.assertNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, null, Class.class, new String[0], 0, null, null, new HashMap<GuixGenerator, JavaFile>())); + Assert.assertNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, null, Class.class, new String[0], 0, null, "", null)); + Assert.assertNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, null, null, new String[0], 0, null, "", new HashMap<GuixGenerator, JavaFile>())); + //tests with a class parameter not null + //tests if a null listener as result returns null + Assert.assertNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, null, ToggleButton.class, new String[]{"isDown()"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>())); + //tests a successful generation with a method as a binding + Assert.assertNotNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), new ToggleButtonHandler(), null, ToggleButton.class, new String[]{"isDown()"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>())); + Assert.assertEquals(gg.generateBindings(new StringBuffer(), new StringBuffer(), new ToggleButtonHandler(), null, ToggleButton.class, new String[]{"isDown()"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()).size(),1); + Assert.assertNotNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), new ToggleButtonHandler(), null, ToggleButton.class, new String[]{"isDown()"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()).get(0)); + Assert.assertEquals(gg.generateBindings(new StringBuffer(), new StringBuffer(), new ToggleButtonHandler(), null, ToggleButton.class, new String[]{"isDown()"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()).get(0),ClickListener.class); + //tests a successful generation with an attribute as a binding + Assert.assertNotNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), new ToggleButtonHandler(), null, ToggleButton.class, new String[]{"down"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>())); + Assert.assertEquals(gg.generateBindings(new StringBuffer(), new StringBuffer(), new ToggleButtonHandler(), null, ToggleButton.class, new String[]{"down"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()).size(),1); + Assert.assertNotNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), new ToggleButtonHandler(), null, ToggleButton.class, new String[]{"down"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()).get(0)); + Assert.assertEquals(gg.generateBindings(new StringBuffer(), new StringBuffer(), new ToggleButtonHandler(), null, ToggleButton.class, new String[]{"down"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()).get(0),ClickListener.class); + //tests a successful generation with a method with the generic name as a binding + Assert.assertNotNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), new ToggleButtonHandler(), null, ToggleButton.class, new String[]{"isSelected()"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>())); + Assert.assertEquals(gg.generateBindings(new StringBuffer(), new StringBuffer(), new ToggleButtonHandler(), null, ToggleButton.class, new String[]{"isSelected()"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()).size(),1); + Assert.assertNotNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), new ToggleButtonHandler(), null, ToggleButton.class, new String[]{"isSelected()"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()).get(0)); + Assert.assertEquals(gg.generateBindings(new StringBuffer(), new StringBuffer(), new ToggleButtonHandler(), null, ToggleButton.class, new String[]{"isSelected()"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()).get(0),ClickListener.class); + //tests a successful generation with an attribute with the generic name as a binding + Assert.assertNotNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), new ToggleButtonHandler(), null, ToggleButton.class, new String[]{"selected"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>())); + Assert.assertEquals(gg.generateBindings(new StringBuffer(), new StringBuffer(), new ToggleButtonHandler(), null, ToggleButton.class, new String[]{"selected"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()).size(),1); + Assert.assertNotNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), new ToggleButtonHandler(), null, ToggleButton.class, new String[]{"selected"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()).get(0)); + Assert.assertEquals(gg.generateBindings(new StringBuffer(), new StringBuffer(), new ToggleButtonHandler(), null, ToggleButton.class, new String[]{"selected"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()).get(0),ClickListener.class); + + //tests with a javafile parameter not null + //tests if the result is null without the taghandler associated to the field + JavaFile jf = new JavaFile(); + jf.addField(new JavaField(Modifier.PRIVATE, "com.google.gwt.user.client.ui.ToggleButton", "button", null)); + jf.addMethod(new JavaMethod(Modifier.PUBLIC, "com.google.gwt.user.client.ui.ToggleButton", "getButton", null, null, "", null)); + Assert.assertNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"getButton()", "isDown()"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>())); + //tests a successful generation with a method as a binding + jf = new JavaFile(); + jf.addField(new JavaField(Modifier.PRIVATE, "com.google.gwt.user.client.ui.ToggleButton", "button", null, new ToggleButtonHandler())); + jf.addMethod(new JavaMethod(Modifier.PUBLIC, "com.google.gwt.user.client.ui.ToggleButton", "getButton", null, null, "", null)); + Assert.assertNotNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"getButton()", "isDown()"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>())); + Assert.assertEquals(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"getButton()", "isDown()"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()).size(),1); + Assert.assertNotNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"getButton()", "isDown()"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()).get(0)); + Assert.assertEquals(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"getButton()", "isDown()"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()).get(0),ClickListener.class); + //tests a successful generation with an attribute as a binding + Assert.assertNotNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"button","down"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>())); + Assert.assertEquals(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"button","down"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()).size(),1); + Assert.assertNotNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"button","down"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()).get(0)); + Assert.assertEquals(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"button","down"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>()).get(0),ClickListener.class); + + //tests with a javafile parameter not null with an attribute whose type is another generated file + //tests if the result is null without the taghandler associated to the field + jf = new JavaFile(); + jf.addField(new JavaField(Modifier.PRIVATE, "test.Test", "test", null)); + jf.addMethod(new JavaMethod(Modifier.PUBLIC, "test.Test", "getTest", null, null, "", null)); + JavaFile jf2 = new JavaFile(Modifier.PUBLIC, JavaFile.CLASS, "test", "Test", null, null); + jf2.addField(new JavaField(Modifier.PRIVATE, "com.google.gwt.user.client.ui.ToggleButton", "button", null)); + jf2.addMethod(new JavaMethod(Modifier.PUBLIC, "com.google.gwt.user.client.ui.ToggleButton", "getButton", null, null, "", null)); + Assert.assertNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"getTest()","getButton()","isDown()"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>())); + //test without jf2 in the map of generators with JavaFile + jf2 = new JavaFile(Modifier.PUBLIC, JavaFile.CLASS, "test", "Test", null, null); + jf2.addField(new JavaField(Modifier.PRIVATE, "com.google.gwt.user.client.ui.ToggleButton", "button", null, new ToggleButtonHandler())); + jf2.addMethod(new JavaMethod(Modifier.PUBLIC, "com.google.gwt.user.client.ui.ToggleButton", "getButton", null, null, "", null)); + Assert.assertNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"getTest()","getButton()","isDown()"}, 0, null, "", new HashMap<GuixGenerator, JavaFile>())); + Map<GuixGenerator,JavaFile> map = new HashMap<GuixGenerator, JavaFile>(); + map.put(gg, jf2); + //tests a successful generation with a method as a binding + Assert.assertNotNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"getTest()","getButton()", "isDown()"}, 0, null, "", map)); + Assert.assertEquals(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"getTest()","getButton()", "isDown()"}, 0, null, "", map).size(),1); + Assert.assertNotNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"getTest()","getButton()", "isDown()"}, 0, null, "", map).get(0)); + Assert.assertEquals(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"getTest()","getButton()", "isDown()"}, 0, null, "", map).get(0),ClickListener.class); + //tests a successful generation with an attribute as a binding + Assert.assertNotNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"test","button","down"}, 0, null, "", map)); + Assert.assertEquals(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"test","button","down"}, 0, null, "", map).size(),1); + Assert.assertNotNull(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"test","button","down"}, 0, null, "", map).get(0)); + Assert.assertEquals(gg.generateBindings(new StringBuffer(), new StringBuffer(), null, jf, null, new String[]{"test","button","down"}, 0, null, "", map).get(0),ClickListener.class); + } + +}