@Test public void tasksCanBeUpdatedWithEmptyTitle() { TaskDetails details = TaskDetails.create("T1", "This is a task"); AddEditTaskModel updatingATask = AddEditTaskModel.builder().mode(AddEditTaskMode.update("123")).details(details).build(); TaskDetails updatedDetails = details.toBuilder().title("").description("Hello World").build(); updateSpec .given(updatingATask) .when(taskDefinitionCompleted(" ", "Hello World")) .then( assertThatNext( hasModel(updatingATask.withDetails(updatedDetails)), hasEffects(saveTask(Task.create("123", updatedDetails))))); }
@Nonnull public static Next<AddEditTaskModel, AddEditTaskEffect> update( AddEditTaskModel model, AddEditTaskEvent event) { return event.map( taskDefinitionCompleted -> onTaskDefinitionCompleted(model, taskDefinitionCompleted), taskCreatedSuccessfully -> exitWithSuccess(), taskCreationFailed -> exitWithFailure(), taskUpdatedSuccessfully -> exitWithSuccess(), taskUpdateFailed -> exitWithFailure()); }
AddEditTaskLogic { @Nonnull public static Next<AddEditTaskModel, AddEditTaskEffect> update( AddEditTaskModel model, AddEditTaskEvent event) { return event.map( taskDefinitionCompleted -> onTaskDefinitionCompleted(model, taskDefinitionCompleted), taskCreatedSuccessfully -> exitWithSuccess(), taskCreationFailed -> exitWithFailure(), taskUpdatedSuccessfully -> exitWithSuccess(), taskUpdateFailed -> exitWithFailure()); } }
AddEditTaskLogic { @Nonnull public static Next<AddEditTaskModel, AddEditTaskEffect> update( AddEditTaskModel model, AddEditTaskEvent event) { return event.map( taskDefinitionCompleted -> onTaskDefinitionCompleted(model, taskDefinitionCompleted), taskCreatedSuccessfully -> exitWithSuccess(), taskCreationFailed -> exitWithFailure(), taskUpdatedSuccessfully -> exitWithSuccess(), taskUpdateFailed -> exitWithFailure()); }  }
AddEditTaskLogic { @Nonnull public static Next<AddEditTaskModel, AddEditTaskEffect> update( AddEditTaskModel model, AddEditTaskEvent event) { return event.map( taskDefinitionCompleted -> onTaskDefinitionCompleted(model, taskDefinitionCompleted), taskCreatedSuccessfully -> exitWithSuccess(), taskCreationFailed -> exitWithFailure(), taskUpdatedSuccessfully -> exitWithSuccess(), taskUpdateFailed -> exitWithFailure()); }  @Nonnull static Next<AddEditTaskModel, AddEditTaskEffect> update(
      AddEditTaskModel model, AddEditTaskEvent event); }
AddEditTaskLogic { @Nonnull public static Next<AddEditTaskModel, AddEditTaskEffect> update( AddEditTaskModel model, AddEditTaskEvent event) { return event.map( taskDefinitionCompleted -> onTaskDefinitionCompleted(model, taskDefinitionCompleted), taskCreatedSuccessfully -> exitWithSuccess(), taskCreationFailed -> exitWithFailure(), taskUpdatedSuccessfully -> exitWithSuccess(), taskUpdateFailed -> exitWithFailure()); }  @Nonnull static Next<AddEditTaskModel, AddEditTaskEffect> update(
      AddEditTaskModel model, AddEditTaskEvent event);  }