示例#1
0
  @Test
  public void shouldNotSaveMotherOrChildFormsIfNullAndEmpty() {
    careService.processAndSaveForms(null, new ArrayList<Map<String, String>>());

    List<MotherCase> mothers = template.loadAll(MotherCase.class);
    assertTrue(mothers.isEmpty());

    List<ChildCase> children = template.loadAll(ChildCase.class);
    assertTrue(children.isEmpty());
  }
 private String stateMessage(StringBuilder builder) {
   for (Call receivedCall : receivedCalls) builder.append("\n  Received ").append(receivedCall);
   builder.append("\n");
   if (pendingCalls.isEmpty()) builder.append("\n  Awaiting no further calls");
   else for (Call pendingCall : pendingCalls) builder.append("\n  Awaiting ").append(pendingCall);
   return builder.toString();
 }
  @After
  public void resetServices() {
    final List<TaskModel> tasks = taskServiceStub.cleanup();
    final StringBuffer msg = new StringBuffer();
    for (final TaskModel task : tasks) {
      final ProcessTaskModel processTask = (ProcessTaskModel) task;

      msg.append(processTask.getAction()).append(", ");
    }

    assertTrue("tasks should be empty after test execution. Left: " + msg, tasks.isEmpty());
  }
 public void assertExpectationsMet() throws AssertionFailedError {
   assertTrue(
       stateMessage(new StringBuilder("Expected call never received")), pendingCalls.isEmpty());
 }
  public void call(Call call) throws AssertionFailedError {
    if (pendingCalls.isEmpty() || !pendingCalls.get(0).equals(call))
      fail(stateMessage(new StringBuilder("Unexpected call: ").append(call)));

    receivedCalls.add(pendingCalls.remove(0));
  }