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
This commit is contained in:
parent
0e47a70f9e
commit
cb067ee00c
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2014 the original author or authors.
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -29,6 +29,7 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
|||
import org.springframework.web.context.WebApplicationContext;
|
||||
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.hasSize;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
|
||||
|
@ -71,7 +72,8 @@ public class SampleDataRestApplicationTests {
|
|||
this.mvc.perform(
|
||||
get("/api/cities/search/findByNameAndCountryAllIgnoringCase?name=Melbourne&country=Australia"))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("_embedded.citys", hasSize(1)));
|
||||
.andExpect(jsonPath("state", equalTo("Victoria")))
|
||||
.andExpect(jsonPath("name", equalTo("Melbourne")));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue