|
|
@ -53,15 +53,16 @@ public class XpathRequestMatchersIntegrationTests { |
|
|
|
private static final Map<String, String> NS = |
|
|
|
private static final Map<String, String> NS = |
|
|
|
Collections.singletonMap("ns", "http://example.org/music/people"); |
|
|
|
Collections.singletonMap("ns", "http://example.org/music/people"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private MockRestServiceServer mockServer; |
|
|
|
private MockRestServiceServer mockServer; |
|
|
|
|
|
|
|
|
|
|
|
private RestTemplate restTemplate; |
|
|
|
private RestTemplate restTemplate; |
|
|
|
|
|
|
|
|
|
|
|
private PeopleWrapper people; |
|
|
|
private PeopleWrapper people; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Before |
|
|
|
@Before |
|
|
|
public void setup() { |
|
|
|
public void setup() { |
|
|
|
|
|
|
|
|
|
|
|
List<Person> composers = Arrays.asList( |
|
|
|
List<Person> composers = Arrays.asList( |
|
|
|
new Person("Johann Sebastian Bach").setSomeDouble(21), |
|
|
|
new Person("Johann Sebastian Bach").setSomeDouble(21), |
|
|
|
new Person("Johannes Brahms").setSomeDouble(.0025), |
|
|
|
new Person("Johannes Brahms").setSomeDouble(.0025), |
|
|
@ -83,9 +84,9 @@ public class XpathRequestMatchersIntegrationTests { |
|
|
|
this.mockServer = MockRestServiceServer.createServer(this.restTemplate); |
|
|
|
this.mockServer = MockRestServiceServer.createServer(this.restTemplate); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void testExists() throws Exception { |
|
|
|
public void testExists() throws Exception { |
|
|
|
|
|
|
|
|
|
|
|
String composer = "/ns:people/composers/composer[%s]"; |
|
|
|
String composer = "/ns:people/composers/composer[%s]"; |
|
|
|
String performer = "/ns:people/performers/performer[%s]"; |
|
|
|
String performer = "/ns:people/performers/performer[%s]"; |
|
|
|
|
|
|
|
|
|
|
@ -105,7 +106,6 @@ public class XpathRequestMatchersIntegrationTests { |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void testDoesNotExist() throws Exception { |
|
|
|
public void testDoesNotExist() throws Exception { |
|
|
|
|
|
|
|
|
|
|
|
String composer = "/ns:people/composers/composer[%s]"; |
|
|
|
String composer = "/ns:people/composers/composer[%s]"; |
|
|
|
String performer = "/ns:people/performers/performer[%s]"; |
|
|
|
String performer = "/ns:people/performers/performer[%s]"; |
|
|
|
|
|
|
|
|
|
|
@ -123,7 +123,6 @@ public class XpathRequestMatchersIntegrationTests { |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void testString() throws Exception { |
|
|
|
public void testString() throws Exception { |
|
|
|
|
|
|
|
|
|
|
|
String composerName = "/ns:people/composers/composer[%s]/name"; |
|
|
|
String composerName = "/ns:people/composers/composer[%s]/name"; |
|
|
|
String performerName = "/ns:people/performers/performer[%s]/name"; |
|
|
|
String performerName = "/ns:people/performers/performer[%s]/name"; |
|
|
|
|
|
|
|
|
|
|
@ -146,7 +145,6 @@ public class XpathRequestMatchersIntegrationTests { |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void testNumber() throws Exception { |
|
|
|
public void testNumber() throws Exception { |
|
|
|
|
|
|
|
|
|
|
|
String composerDouble = "/ns:people/composers/composer[%s]/someDouble"; |
|
|
|
String composerDouble = "/ns:people/composers/composer[%s]/someDouble"; |
|
|
|
|
|
|
|
|
|
|
|
this.mockServer.expect(requestTo("/composers")) |
|
|
|
this.mockServer.expect(requestTo("/composers")) |
|
|
@ -180,7 +178,6 @@ public class XpathRequestMatchersIntegrationTests { |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void testNodeCount() throws Exception { |
|
|
|
public void testNodeCount() throws Exception { |
|
|
|
|
|
|
|
|
|
|
|
this.mockServer.expect(requestTo("/composers")) |
|
|
|
this.mockServer.expect(requestTo("/composers")) |
|
|
|
.andExpect(content().contentType("application/xml")) |
|
|
|
.andExpect(content().contentType("application/xml")) |
|
|
|
.andExpect(xpath("/ns:people/composers/composer", NS).nodeCount(4)) |
|
|
|
.andExpect(xpath("/ns:people/composers/composer", NS).nodeCount(4)) |
|
|
@ -223,4 +220,5 @@ public class XpathRequestMatchersIntegrationTests { |
|
|
|
return this.performers; |
|
|
|
return this.performers; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|