Skip to content

Commit cb067ee

Browse files
committed
Align expectations with Spring Data REST’s new behaviour in Fowler
The response produced by Spring Data REST to a search that will always return a single result, i.e. the return type is Foo rather than List<Foo> or Page<Foo> has improved in Fowler. Previously, the response would contain a single embedded resource. In Fowler, the response now contains the resource that used to be embedded as a top-level resource. This commit updates the expectations in one of the sample’s tests to match this new behaviour. See gh-2673
1 parent 0e47a70 commit cb067ee

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

spring-boot-samples/spring-boot-sample-data-rest/src/test/java/sample/data/jpa/SampleDataRestApplicationTests.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2014 the original author or authors.
2+
* Copyright 2012-2015 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -29,6 +29,7 @@
2929
import org.springframework.web.context.WebApplicationContext;
3030

3131
import static org.hamcrest.Matchers.containsString;
32+
import static org.hamcrest.Matchers.equalTo;
3233
import static org.hamcrest.Matchers.hasSize;
3334
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
3435
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
@@ -71,7 +72,8 @@ public void findByNameAndCountry() throws Exception {
7172
this.mvc.perform(
7273
get("/api/cities/search/findByNameAndCountryAllIgnoringCase?name=Melbourne&country=Australia"))
7374
.andExpect(status().isOk())
74-
.andExpect(jsonPath("_embedded.citys", hasSize(1)));
75+
.andExpect(jsonPath("state", equalTo("Victoria")))
76+
.andExpect(jsonPath("name", equalTo("Melbourne")));
7577
}
7678

7779
@Test

0 commit comments

Comments
 (0)