Add tests

This commit is contained in:
James Agnew 2017-11-17 09:53:44 +01:00
parent d006a8e6d0
commit a87323fa08
4 changed files with 2216 additions and 4 deletions

View File

@ -92,6 +92,12 @@
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
</dependency>
</dependencies>
<reporting>

View File

@ -32,6 +32,8 @@ import org.apache.commons.lang3.Validate;
/**
* This interceptor adds an arbitrary header to requests made by this client. Both the
* header name and the header value are specified by the calling code.
*
* @see AdditionalRequestHeadersInterceptor for a more advanced version of this interceptor which can add multiple headers
*/
public class SimpleRequestHeaderInterceptor implements IClientInterceptor {

View File

@ -3149,16 +3149,18 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
.count(1)
.execute();
ourLog.info("** Done searching with count of 1");
ourLog.info("** Done searching in {}ms with count of 1", sw.getMillis());
ourLog.info(myCapturingInterceptor.getLastResponse().getAllHeaders().toString());
assertThat(myCapturingInterceptor.getLastResponse().getHeaders(Constants.HEADER_X_CACHE), Matchers.<String>empty());
assertThat(myCapturingInterceptor.getLastResponse().getHeaders(Constants.HEADER_X_CACHE.toLowerCase()),Matchers.<String>empty());
String msg = "Total is " + found.getTotalElement().getValue() + " and took " + sw.getMillis() + " millis";
// If this fails under load, try increasing the throttle above
assertEquals(null, found.getTotalElement().getValue());
assertEquals(1, found.getEntry().size());
assertThat(sw.getMillis(), lessThan(1000L));
assertEquals(msg,null, found.getTotalElement().getValue());
assertEquals(msg, 1, found.getEntry().size());
assertThat(msg, sw.getMillis(), lessThan(1000L));
}