use of org.springframework.roo.addon.layers.repository.jpa.addon.finder.parser.PartTree in project spring-roo by spring-projects.
the class PartTreeUnitTest method identifiesFindFirstImplicit.
@Test
public void identifiesFindFirstImplicit() {
PartTree partTree = new PartTree("findFirstByText", memberDetails);
assertTrue(partTree.isValid() && partTree.getMaxResults() == 1);
partTree = new PartTree("findTopByText", memberDetails);
assertTrue(partTree.isValid() && partTree.getMaxResults() == 1);
}
use of org.springframework.roo.addon.layers.repository.jpa.addon.finder.parser.PartTree in project spring-roo by spring-projects.
the class PartTreeUnitTest method validateInParameters.
@Test
public void validateInParameters() throws Exception {
List<FinderParameter> parameters = new ArrayList<FinderParameter>();
parameters.add(new FinderParameter(new JavaType(List.class.getName(), 0, DataType.TYPE, null, Arrays.asList(new JavaType(Date.class.getName()))), new JavaSymbolName("dateList")));
assertEqualsParameters(parameters, new PartTree("findByDateIn", memberDetails).getParameters());
}
use of org.springframework.roo.addon.layers.repository.jpa.addon.finder.parser.PartTree in project spring-roo by spring-projects.
the class PartTreeUnitTest method test.
private void test(String prefix, String[] result) {
List<String> options = new PartTree(prefix, memberDetails).getOptions();
assertEqualsList(generateOptions(prefix, result), options);
}
use of org.springframework.roo.addon.layers.repository.jpa.addon.finder.parser.PartTree in project spring-roo by spring-projects.
the class PartTreeUnitTest method validateReturnsTypeString.
@Test
public void validateReturnsTypeString() throws Exception {
JavaType stringPageType = new JavaType("org.springframework.data.domain.Page", 0, DataType.TYPE, null, Arrays.asList(JavaType.STRING));
assertEquals(stringPageType, new PartTree("findDistinctTextByText", memberDetails).getReturnType());
assertEquals(stringPageType, new PartTree("findTextByText", memberDetails).getReturnType());
assertEquals(stringPageType, new PartTree("findTop2TextByText", memberDetails).getReturnType());
assertEquals(stringPageType, new PartTree("findDistinctTop10TextByText", memberDetails).getReturnType());
assertEquals(stringPageType, new PartTree("findFirst2TextByText", memberDetails).getReturnType());
assertEquals(JavaType.STRING, new PartTree("findTopTextByText", memberDetails).getReturnType());
assertEquals(JavaType.STRING, new PartTree("findFirst1TextByText", memberDetails).getReturnType());
assertEquals(JavaType.STRING, new PartTree("findDistinctFirstTextByText", memberDetails).getReturnType());
assertEquals(JavaType.STRING, new PartTree("findDistinctTop1TextByText", memberDetails).getReturnType());
}
use of org.springframework.roo.addon.layers.repository.jpa.addon.finder.parser.PartTree in project spring-roo by spring-projects.
the class PartTreeUnitTest method validateReturnsTypePrimitiveInteger.
@Test
public void validateReturnsTypePrimitiveInteger() throws Exception {
JavaType intPageType = new JavaType("org.springframework.data.domain.Page", 0, DataType.TYPE, null, Arrays.asList(JavaType.INT_OBJECT));
assertEquals(intPageType, new PartTree("findDistinctPrimitiveIntByText", memberDetails).getReturnType());
assertEquals(intPageType, new PartTree("findPrimitiveIntByText", memberDetails).getReturnType());
assertEquals(intPageType, new PartTree("findTop2PrimitiveIntByText", memberDetails).getReturnType());
assertEquals(intPageType, new PartTree("findDistinctTop10PrimitiveIntByText", memberDetails).getReturnType());
assertEquals(intPageType, new PartTree("findFirst2PrimitiveIntByText", memberDetails).getReturnType());
assertEquals(JavaType.INT_PRIMITIVE, new PartTree("findTopPrimitiveIntByText", memberDetails).getReturnType());
assertEquals(JavaType.INT_PRIMITIVE, new PartTree("findFirst1PrimitiveIntByText", memberDetails).getReturnType());
assertEquals(JavaType.INT_PRIMITIVE, new PartTree("findDistinctFirstPrimitiveIntByText", memberDetails).getReturnType());
assertEquals(JavaType.INT_PRIMITIVE, new PartTree("findDistinctTop1PrimitiveIntByText", memberDetails).getReturnType());
}
Aggregations