Created
June 8, 2017 13:12
-
-
Save vyo/4387e1e631c4784656bfe16a470a52d8 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
public class EchoControllerTest extends ControllerTest<EchoController> { | |
private EchoService echoService; | |
@Before | |
public void setup() { | |
echoService = (EchoService) getField(EchoService.class); | |
when(echoService.reverse(eq("input"))).thenReturn("tupni"); | |
} | |
@Test | |
public void echo() throws Exception { | |
String input = "input"; | |
String reverse = new StringBuilder(input).reverse().toString(); | |
Response response = target("echo") | |
.path(input) | |
.request() | |
.get(); | |
assertEquals(Status.OK.getStatusCode(), response.getStatus()); | |
assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getMediaType()); | |
assertEquals(reverse, response.readEntity(Echo.class).getEcho()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment