-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ROASTER-105: Transform imports when adding property with generics
- Loading branch information
Showing
4 changed files
with
61 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -780,7 +780,6 @@ public boolean hasTypeVariable(String name) | |
} | ||
} | ||
return false; | ||
|
||
} | ||
|
||
@SuppressWarnings("unchecked") | ||
|
45 changes: 45 additions & 0 deletions
45
tests/src/test/java/org/jboss/forge/test/roaster/model/PropertiesGenericsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright 2016 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.test.roaster.model; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
import org.jboss.forge.roaster.Roaster; | ||
import org.jboss.forge.roaster.model.Type; | ||
import org.jboss.forge.roaster.model.source.FieldSource; | ||
import org.jboss.forge.roaster.model.source.JavaClassSource; | ||
import org.jboss.forge.roaster.model.source.PropertySource; | ||
import org.junit.Test; | ||
|
||
/** | ||
* | ||
* @author <a href="mailto:ggastald@redhat.com">George Gastaldi</a> | ||
*/ | ||
public class PropertiesGenericsTest | ||
{ | ||
@Test | ||
public void addGenericAndGetPropertyType() | ||
{ | ||
JavaClassSource classSource = Roaster.create(JavaClassSource.class); | ||
classSource.addProperty("java.util.List<java.lang.String>", "list"); | ||
PropertySource<JavaClassSource> property = classSource.getProperty("list"); | ||
Type<JavaClassSource> propertyType = property.getType(); | ||
assertEquals("List<String>", propertyType.toString()); | ||
} | ||
|
||
@Test | ||
public void addGenericAndGetFieldType() | ||
{ | ||
JavaClassSource classSource = Roaster.create(JavaClassSource.class); | ||
classSource.addProperty("java.util.List<java.lang.String>", "list"); | ||
PropertySource<JavaClassSource> property = classSource.getProperty("list"); | ||
FieldSource<JavaClassSource> field = property.getField(); | ||
Type<JavaClassSource> fieldType = field.getType(); | ||
assertEquals("List<String>", fieldType.toString()); | ||
} | ||
} |