@Test public void givenInboxWhenCreateNewTaskThenNewTaskCreated() { Inbox inbox = new Inbox(); Inbox.ChangeDescription changeDescription = new Inbox.ChangeDescription(); changeDescription.description = "Description"; Inbox.NewTask newTask = new Inbox.NewTask(); newTask.changeDescription = changeDescription; Interaction interaction = Inbox.newTask().apply(inbox).apply(newTask).getInteraction(); Iterator<Event> events = interaction.getEvents().iterator(); CreatedEvent createdTask = (CreatedEvent) events.next(); }
public static Function<Inbox, Function<NewTask, Task>> newTask() { return inbox -> newTask -> { Task task = new Task(newTask.id); inbox.select(task); changeDescription().apply(inbox).apply(newTask.changeDescription); return task; }; }
Inbox { public static Function<Inbox, Function<NewTask, Task>> newTask() { return inbox -> newTask -> { Task task = new Task(newTask.id); inbox.select(task); changeDescription().apply(inbox).apply(newTask.changeDescription); return task; }; } }
Inbox { public static Function<Inbox, Function<NewTask, Task>> newTask() { return inbox -> newTask -> { Task task = new Task(newTask.id); inbox.select(task); changeDescription().apply(inbox).apply(newTask.changeDescription); return task; }; }  }
Inbox { public static Function<Inbox, Function<NewTask, Task>> newTask() { return inbox -> newTask -> { Task task = new Task(newTask.id); inbox.select(task); changeDescription().apply(inbox).apply(newTask.changeDescription); return task; }; }  void select(Task task); static Function<Inbox, Function<NewTask, Task>> newTask(); static Function<Inbox, Function<ChangeDescription, InteractionSource>> changeDescription(); static Function<Inbox, Function<TaskDone, InteractionSource>> done(); }
Inbox { public static Function<Inbox, Function<NewTask, Task>> newTask() { return inbox -> newTask -> { Task task = new Task(newTask.id); inbox.select(task); changeDescription().apply(inbox).apply(newTask.changeDescription); return task; }; }  void select(Task task); static Function<Inbox, Function<NewTask, Task>> newTask(); static Function<Inbox, Function<ChangeDescription, InteractionSource>> changeDescription(); static Function<Inbox, Function<TaskDone, InteractionSource>> done();  }