diff --git a/impl/src/test/java/org/jboss/forge/test/roaster/model/JavaClassPropertyTest.java b/impl/src/test/java/org/jboss/forge/test/roaster/model/JavaClassPropertyTest.java index 4f0d06d7..990011f5 100644 --- a/impl/src/test/java/org/jboss/forge/test/roaster/model/JavaClassPropertyTest.java +++ b/impl/src/test/java/org/jboss/forge/test/roaster/model/JavaClassPropertyTest.java @@ -22,18 +22,41 @@ */ public class JavaClassPropertyTest { - public JavaClassSource getSource() + @Test + public void testProperties() { InputStream stream = JavaClassTest.class .getResourceAsStream("/org/jboss/forge/grammar/java/MockUnformattedClass.java"); - return Roaster.parse(JavaClassSource.class, stream); + JavaClassSource source = Roaster.parse(JavaClassSource.class, stream); + List> properties = source.getProperties(); + Assert.assertEquals(2, properties.size()); } @Test - public void testProperties() + public void testPrimitiveBooleanProperties() { - List> properties = getSource().getProperties(); + InputStream stream = JavaClassTest.class + .getResourceAsStream("/org/jboss/forge/grammar/java/BooleanPrimitiveClass.java"); + JavaClassSource source = Roaster.parse(JavaClassSource.class, stream); + List> properties = source.getProperties(); Assert.assertEquals(2, properties.size()); + Assert.assertNotNull(source.getProperty("myString").getAccessor()); + Assert.assertNotNull(source.getProperty("myString").getMutator()); + Assert.assertNotNull(source.getProperty("myBoolean").getAccessor()); + Assert.assertNotNull(source.getProperty("myBoolean").getMutator()); } + @Test + public void testBooleanProperties() + { + InputStream stream = JavaClassTest.class + .getResourceAsStream("/org/jboss/forge/grammar/java/BooleanClass.java"); + JavaClassSource source = Roaster.parse(JavaClassSource.class, stream); + List> properties = source.getProperties(); + Assert.assertEquals(2, properties.size()); + Assert.assertNotNull(source.getProperty("myString").getAccessor()); + Assert.assertNotNull(source.getProperty("myString").getMutator()); + Assert.assertNotNull(source.getProperty("myBoolean").getAccessor()); + Assert.assertNotNull(source.getProperty("myBoolean").getMutator()); + } } diff --git a/impl/src/test/resources/org/jboss/forge/grammar/java/BooleanClass.java b/impl/src/test/resources/org/jboss/forge/grammar/java/BooleanClass.java new file mode 100644 index 00000000..b62c1cd3 --- /dev/null +++ b/impl/src/test/resources/org/jboss/forge/grammar/java/BooleanClass.java @@ -0,0 +1,33 @@ +/* + * Copyright 2014 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Eclipse Public License version 1.0, available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.jboss.forge.grammar.java; + +public class BooleanClass +{ + private String myString; + private Boolean myBoolean; + + public String getMyString() + { + return myString; + } + + public void setMyString(String myString) + { + this.myString = myString; + } + + public Boolean getMyBoolean() + { + return myBoolean; + } + + public void setMyBoolean(Boolean myBoolean) + { + this.myBoolean = myBoolean; + } +} \ No newline at end of file diff --git a/impl/src/test/resources/org/jboss/forge/grammar/java/BooleanPrimitiveClass.java b/impl/src/test/resources/org/jboss/forge/grammar/java/BooleanPrimitiveClass.java new file mode 100644 index 00000000..62b0e7d1 --- /dev/null +++ b/impl/src/test/resources/org/jboss/forge/grammar/java/BooleanPrimitiveClass.java @@ -0,0 +1,33 @@ +/* + * Copyright 2014 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Eclipse Public License version 1.0, available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package org.jboss.forge.grammar.java; + +public class BooleanPrimitiveClass +{ + private String myString; + private boolean myBoolean; + + public String getMyString() + { + return myString; + } + + public void setMyString(String myString) + { + this.myString = myString; + } + + public boolean isMyBoolean() + { + return myBoolean; + } + + public void setMyBoolean(boolean myBoolean) + { + this.myBoolean = myBoolean; + } +} \ No newline at end of file