Skip to content

Commit

Permalink
DATACMNS-368 - Add test for PartTree properties that contain keyword …
Browse files Browse the repository at this point in the history
…sequences.

Added appropriate test to PartTreeUnitTests to check whether the regular expression in PartTree doesn't accidentally finds keywords in property expressions.
  • Loading branch information
Thomas Darimont authored and odrotbohm committed Sep 23, 2013
1 parent cccaba3 commit 61373d8
Showing 1 changed file with 35 additions and 0 deletions.
Expand Up @@ -40,6 +40,7 @@
*
* @author Oliver Gierke
* @author Phillip Webb
* @author Thomas Darimont
*/
public class PartTreeUnitTests {

Expand Down Expand Up @@ -357,6 +358,22 @@ public void resolvesPropertyPathFromGettersOnInterfaces() {
assertThat(new PartTree("findByCategoryId", Product.class), is(notNullValue()));
}

/**
* @see DATACMNS-368
*/
@Test
public void detectPropertyWithOrKeywordPart() {
assertThat(new PartTree("findByOrder", Product.class), is(notNullValue()));
}

/**
* @see DATACMNS-368
*/
@Test
public void detectPropertyWithAndKeywordPart() {
assertThat(new PartTree("findByAnders", Product.class), is(notNullValue()));
}

private static void assertType(Iterable<String> sources, Type type, String property) {
assertType(sources, type, property, 1, true);
}
Expand Down Expand Up @@ -434,15 +451,33 @@ class Organization {
class DomainObjectWithSpecialChars {
String øre;
String år;

public Order getOrder() {
return null;
}
}

interface Product {

Order getOrder(); // contains Or keyword

Anders getAnders(); // constains And keyword

Category getCategory();
}

interface Category {

Long getId();
}

interface Order {

Long getId();
}

interface Anders {

Long getId();
}
}

0 comments on commit 61373d8

Please sign in to comment.