Potential solution for #47 (bad test)

This commit is contained in:
James Agnew 2014-11-03 18:48:32 -05:00
parent 5aafeee3d3
commit 1bd51f6118
1 changed files with 9 additions and 9 deletions

View File

@ -15,6 +15,7 @@ import java.nio.charset.Charset;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.TimeZone;
import org.apache.commons.io.IOUtils;
import org.apache.commons.io.input.ReaderInputStream;
@ -525,17 +526,16 @@ public class ClientTest {
ITestClient client = ctx.newRestfulClient(ITestClient.class, "http://foo");
client.getHistoryPatientInstance(new IdDt("111"), new InstantDt("2012-01-02T00:01:02"), new IntegerDt(12));
// ensures the local timezone
String expectedDateString = new InstantDt(new InstantDt("2012-01-02T12:01:02").getValue()).getValueAsString();
expectedDateString = expectedDateString.replace(":", "%3A").replace("+", "%2B");
client.getHistoryPatientInstance(new IdDt("111"), new InstantDt("2012-01-02T12:01:02"), new IntegerDt(12));
assertThat(capt.getAllValues().get(0).getURI().toString(), containsString("http://foo/Patient/111/_history?"));
assertThat(capt.getAllValues().get(0).getURI().toString(), containsString("_since=2012-01-02T00%3A01%3A02"));
assertThat(capt.getAllValues().get(0).getURI().toString(), containsString("_since="+expectedDateString.replaceAll("\\..*", "")));
assertThat(capt.getAllValues().get(0).getURI().toString(), containsString("_count=12"));
String expectedDateString = new InstantDt(new InstantDt("2012-01-02T00:01:02").getValue()).getValueAsString(); // ensures
// the
// local
// timezone
expectedDateString = expectedDateString.replace(":", "%3A");
client.getHistoryPatientInstance(new IdDt("111"), new InstantDt("2012-01-02T00:01:02").getValue(), new IntegerDt(12).getValue());
client.getHistoryPatientInstance(new IdDt("111"), new InstantDt("2012-01-02T12:01:02").getValue(), new IntegerDt(12).getValue());
assertThat(capt.getAllValues().get(1).getURI().toString(), containsString("http://foo/Patient/111/_history?"));
assertThat(capt.getAllValues().get(1).getURI().toString(), containsString("_since="+expectedDateString));
assertThat(capt.getAllValues().get(1).getURI().toString(), containsString("_count=12"));