Created
April 24, 2020 11:34
-
-
Save hakansander/6bb2bac220a7291ffcbc839ab9ae3466 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void testWhenInternalServerError_thenReturnHttp500() throws Exception { | |
String mockPhoneNum = "542*******"; | |
this.mockServer.expect(ExpectedCount.once(), requestTo(invoiceUrl | |
+ mockPhoneNum)) | |
.andExpect(MockRestRequestMatchers.method(HttpMethod.GET)) | |
.andRespond((response) -> { throw new RuntimeException(); }); | |
responseInvoiceResponseEntity = mockService.getInvoiceInfo(mockPhoneNum); | |
mockServer.verify(); | |
Assert.assertEquals("500", responseInvoiceResponseEntity. | |
getStatusCode()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment