From 7daca726c0c1af3f90a4999bf60a3ace70ffdb93 Mon Sep 17 00:00:00 2001 From: Oliver Gierke Date: Thu, 3 Sep 2015 17:56:14 +0200 Subject: [PATCH] DATAREST-668 - Added test case to verify search links are created correctly. Added a test case that explictly verifies the projection template variable being added to search links for domain types with projections registered. Related tickets: DATAREST-467, DATAREST-519. --- .../RepositoryEntityLinksIntegrationTests.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/support/RepositoryEntityLinksIntegrationTests.java b/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/support/RepositoryEntityLinksIntegrationTests.java index 7def69de3..09d12b42c 100644 --- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/support/RepositoryEntityLinksIntegrationTests.java +++ b/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/support/RepositoryEntityLinksIntegrationTests.java @@ -174,4 +174,17 @@ public class RepositoryEntityLinksIntegrationTests extends AbstractControllerInt UriComponents components = UriComponentsBuilder.fromUriString(link.getHref()).build(); assertThat(components.getQueryParams(), hasKey("sort")); } + + /** + * @see DATAREST-668 + * @see DATAREST-519 + * @see DATAREST-467 + */ + @Test + public void addsProjectVariableToSearchResourceIfAvailable() { + + for (Link link : entityLinks.linksToSearchResources(Book.class)) { + assertThat(link.getVariableNames(), hasItem("projection")); + } + } }