Skip to content

Instantly share code, notes, and snippets.

@panayotkulchev
Created June 17, 2015 14:16
Show Gist options
  • Save panayotkulchev/db7d8da768fafc9f9e3a to your computer and use it in GitHub Desktop.
Save panayotkulchev/db7d8da768fafc9f9e3a to your computer and use it in GitHub Desktop.
First test of clouway-hr
public class RestfulWebServiceTest {
@Rule
public JUnitRuleMockery context = new JUnitRuleMockery();
@Mock
Request request;
@Mock
VacationRepository vacationRepository;
@Test
public void approveVacation() {
final String vacationId = "123";
final String status = "approved";
RestfulWebService service = new RestfulWebService(vacationRepository);
context.checking(new Expectations() {{
oneOf(vacationRepository).updateStatus(vacationId, status);
}});
Reply<Object> reply = service.approveVacation(request, vacationId, status);
assertThat(reply, is(Reply.saying().ok()));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment