Skip to content

Commit

Permalink
replace hamcrest with assertj
Browse files Browse the repository at this point in the history
  • Loading branch information
fil512 committed May 22, 2024
1 parent 66138f9 commit b5f0d3f
Showing 1 changed file with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@
import java.util.Map;

import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsStringIgnoringCase;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.stringContainsInOrder;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNull;
Expand Down Expand Up @@ -522,7 +518,7 @@ public void testGetInvalidResourceNoAcceptHeader() throws Exception {
assertEquals(404, status.getStatusLine().getStatusCode());

assertThat(responseContent).doesNotContainPattern("(?s)<span class='hlTagName'>OperationOutcome</span>.*Unknown resource type 'Foobar' - Server knows how to handle");
assertThat(responseContent, (stringContainsInOrder("Unknown resource type 'Foobar'")));
assertThat(responseContent).contains("Unknown resource type 'Foobar'");
assertEquals(Constants.CT_FHIR_XML_NEW + ";charset=utf-8", status.getFirstHeader("content-type").getValue().replace(" ", "").toLowerCase());

}
Expand Down Expand Up @@ -844,7 +840,7 @@ public void testPrettyPrintDefaultsToTrue() throws Exception {
status.close();
ourLog.info(responseContent);
assertEquals(200, status.getStatusLine().getStatusCode());
assertThat(responseContent, (stringContainsInOrder("<body>", "<pre>", "<div", "</pre>")));
assertThat(responseContent).containsSubsequence("<body>", "<pre>", "<div", "</pre>");
}

/**
Expand Down Expand Up @@ -880,7 +876,7 @@ public void testPrettyPrintDefaultsToTrueWithExplicitTrue() throws Exception {
status.close();
ourLog.info(responseContent);
assertEquals(200, status.getStatusLine().getStatusCode());
assertThat(responseContent, (stringContainsInOrder("<body>", "<pre>", "<div", "</pre>")));
assertThat(responseContent).containsSubsequence("<body>", "<pre>", "<div", "</pre>");
}

@Test
Expand Down Expand Up @@ -926,7 +922,7 @@ public void testShowRequest() throws Exception {
ourLog.info(responseContent);
assertEquals(200, status.getStatusLine().getStatusCode());
assertEquals("text/html;charset=utf-8", status.getFirstHeader("content-type").getValue().replace(" ", "").toLowerCase());
assertThat(responseContent, (containsStringIgnoringCase("Accept")));
assertThat(responseContent).containsIgnoringCase("Accept");
assertThat(responseContent).doesNotContainIgnoringCase("Content-Type");
}

Expand All @@ -943,8 +939,8 @@ public void testShowRequestAndResponse() throws Exception {
ourLog.info(responseContent);
assertEquals(200, status.getStatusLine().getStatusCode());
assertEquals("text/html;charset=utf-8", status.getFirstHeader("content-type").getValue().replace(" ", "").toLowerCase());
assertThat(responseContent, (containsStringIgnoringCase("Accept")));
assertThat(responseContent, (containsStringIgnoringCase("Content-Type")));
assertThat(responseContent).containsIgnoringCase("Accept");
assertThat(responseContent).containsIgnoringCase("Content-Type");
}

@Test
Expand All @@ -960,7 +956,7 @@ public void testShowResponse() throws Exception {
assertEquals(200, status.getStatusLine().getStatusCode());
assertEquals("text/html;charset=utf-8", status.getFirstHeader("content-type").getValue().replace(" ", "").toLowerCase());
assertThat(responseContent).doesNotContainIgnoringCase("Accept");
assertThat(responseContent, (containsStringIgnoringCase("Content-Type")));
assertThat(responseContent).containsIgnoringCase("Content-Type");
}

@Test
Expand Down

0 comments on commit b5f0d3f

Please sign in to comment.