Skip to content

Commit

Permalink
Merge pull request #131 from gastaldi/FORGE-523
Browse files Browse the repository at this point in the history
FORGE-523: Check if java extension if passed to custom command
  • Loading branch information
lincolnthree committed Apr 3, 2012
2 parents ebbdb1d + 05827fb commit a75c80a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
Expand Up @@ -104,7 +104,9 @@ public void newCustomField(
try
{
JavaClass entity = getJavaClass();
addFieldTo(entity, type, fieldName, Column.class);
String javaType = (type.toLowerCase().endsWith(".java")) ? type.substring(0, type.length() - 5) : type;

addFieldTo(entity, javaType, fieldName, Column.class);
}
catch (FileNotFoundException e)
{
Expand Down
Expand Up @@ -90,6 +90,24 @@ public void testNewCustomField() throws Exception
assertFalse(javaClass.hasSyntaxErrors());
}

@Test
public void testNewCustomFieldJavaExtension() throws Exception
{
Project project = getProject();
JavaClass javaClass = generateEntity(project);

getShell().execute(
ConstraintInspector.getName(FieldPlugin.class)
+ " custom --named gamesPlayed --type org.jboss.CustomType.java");

javaClass = (JavaClass) project.getFacet(JavaSourceFacet.class).getJavaResource(javaClass).getJavaSource();
assertTrue(javaClass.hasField("gamesPlayed"));
assertEquals("CustomType", javaClass.getField("gamesPlayed").getType());
assertTrue(javaClass.hasImport("org.jboss.CustomType"));
assertFalse(javaClass.hasSyntaxErrors());
}


@Test
public void testNewTemporalField() throws Exception
{
Expand Down

0 comments on commit a75c80a

Please sign in to comment.