Skip to content
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.

Commit

Permalink
Modify tests to reflect desired import behavior
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Bluhm <bluhmdj@ornl.gov>
  • Loading branch information
dbluhm committed Aug 6, 2020
1 parent 1f2ca45 commit e9f8c49
Show file tree
Hide file tree
Showing 11 changed files with 71 additions and 21 deletions.
Expand Up @@ -78,7 +78,9 @@ private static enum Inputs implements JavaFileObjectResource{
DATAFIELD_SETTER("Setter.java"),
DATAFIELD_MATCH("Match.java"),
DEFAULT_NON_STRING("DefaultNonString.java"),
DEFAULT_STRING("DefaultString.java");
DEFAULT_STRING("DefaultString.java"),
BOXED_TYPES("BoxedTypes.java"),
INNER_CLASS_TYPES("InnerClassTypes.java");

/**
* Parent directory of inputs. Prepended to all paths.
Expand Down Expand Up @@ -116,7 +118,9 @@ private static enum Patterns implements JavaFileObjectResource {
DATAFIELD_GETTER_INT("Getter.java"),
DATAFIELD_SETTER_INT("Setter.java"),
DEFAULT_NON_STRING_IMPL("DefaultNonStringImplementation.java"),
DEFAULT_STRING_IMPL("DefaultStringImplementation.java");
DEFAULT_STRING_IMPL("DefaultStringImplementation.java"),
BOXED_TYPES_INT("BoxedTypesInterface.java"),
INNER_CLASS_TYPES_INT("InnerClassTypesInterface.java");

/**
* Parent directory of inputs. Prepended to all paths.
Expand Down Expand Up @@ -267,6 +271,26 @@ void testManyNonPrimitiveDataFieldSucceeds() {
assertImplementationMatches(compilation, Patterns.MANY_NON_PRIMITIVE_IMPL.get());
}

/**
* Test that boxed types' type parameters are preserved.
*/
@Test
void testBoxedTypeParametersPreserved() {
Compilation compilation = helper.compile(Inputs.BOXED_TYPES.get());
assertDefaultsPresent(compilation);
assertInterfaceMatches(compilation, Patterns.BOXED_TYPES_INT.get());
}

/**
* Test that inner class types and their type parameters are preserved.
*/
@Test
void testInnerClassTypes() {
Compilation compilation = helper.compile(Inputs.INNER_CLASS_TYPES.get());
assertDefaultsPresent(compilation);
assertInterfaceMatches(compilation, Patterns.INNER_CLASS_TYPES_INT.get());
}

/**
* Test that Doc Comments are preserved on elements annotated with
* {@code @DataField}.
Expand Down
@@ -0,0 +1,8 @@
import java.util.List;
import org.eclipse.ice.dev.annotations.DataElement;
import org.eclipse.ice.dev.annotations.DataField;

@DataElement(name = "Test")
public class BoxedTypes {
@DataField public List<String> stringList;
}
@@ -0,0 +1,8 @@
import java.util.Map;
import org.eclipse.ice.dev.annotations.DataElement;
import org.eclipse.ice.dev.annotations.DataField;

@DataElement(name = "Test")
public class InnerClassTypes {
@DataField public Map.Entry<String, Object> testMapEntry;
}
@@ -0,0 +1,5 @@
import org.eclipse.ice.data.IDataElement;
public interface Test extends IDataElement<Test> {
public List<String> getStringList();
public void setStringList(List<String> stringList);
}
Expand Up @@ -8,5 +8,5 @@
)
@JsonIgnoreProperties(ignoreUnknown = true)
public class TestImplementation implements Test, Serializable {
@NonNull public java.lang.String test = "A String Value";
@NonNull public String test = "A String Value";
}
Expand Up @@ -11,13 +11,13 @@ public class TestImplementation implements Test, Serializable {
@NonNull
@Getter(AccessLevel.NONE)
@Setter(AccessLevel.NONE)
protected java.util.UUID privateId = java.util.UUID.randomUUID();
protected UUID privateId = UUID.randomUUID();
protected long id = 0L;
@NonNull protected java.lang.String name = "name";
@NonNull protected java.lang.String description = "description";
@NonNull protected java.lang.String comment = "no comment";
@NonNull protected java.lang.String context = "default";
@NonNull protected String name = "name";
@NonNull protected String description = "description";
@NonNull protected String comment = "no comment";
@NonNull protected String context = "default";
protected boolean required = false;
protected boolean secret = false;
protected org.eclipse.ice.data.JavascriptValidator<Test> validator;
protected JavascriptValidator validator;
}
@@ -0,0 +1,5 @@
import org.eclipse.ice.data.IDataElement;
public interface Test extends IDataElement<Test> {
public Entry<String, Object> getTestMapEntry();
public void setTestMapEntry(Entry<String, Object> testMapEntry);
}
@@ -1,9 +1,9 @@
import org.eclipse.ice.data.IDataElement;
public interface Test extends IDataElement<Test> {
public java.util.UUID getTestUuid();
public void setTestUuid(java.util.UUID testUuid);
public java.lang.String getTestString();
public void setTestString(java.lang.String testString);
public java.util.Date getTestDate();
public void setTestDate(java.util.Date testDate);
public UUID getTestUuid();
public void setTestUuid(UUID testUuid);
public String getTestString();
public void setTestString(String testString);
public Date getTestDate();
public void setTestDate(Date testDate);
}
Expand Up @@ -8,7 +8,7 @@
)
@JsonIgnoreProperties(ignoreUnknown = true)
public class TestImplementation implements Test, Serializable {
@NonNull public java.util.UUID testUuid;
@NonNull public java.lang.String testString;
@NonNull public java.util.Date testDate;
@NonNull public UUID testUuid;
@NonNull public String testString;
@NonNull public Date testDate;
}
@@ -1,5 +1,5 @@
import org.eclipse.ice.data.IDataElement;
public interface Test extends IDataElement<Test> {
public java.util.UUID getTestUuid();
public void setTestUuid(java.util.UUID testUuid);
public UUID getTestUuid();
public void setTestUuid(UUID testUuid);
}
Expand Up @@ -8,5 +8,5 @@
)
@JsonIgnoreProperties(ignoreUnknown = true)
public class TestImplementation implements Test, Serializable {
@NonNull public java.util.UUID testUuid;
@NonNull public UUID testUuid;
}

0 comments on commit e9f8c49

Please sign in to comment.