### Question:
Execution implements Serializable, Comparable<Execution> { public Execution addInput(Input input) { inputs.add(input); return this; } Execution();  Execution(Algorithm algorithm);  Execution(Algorithm algorithm, long begin); @Id @GeneratedValue long getId(); Execution setId(long id); String getIdentifier(); Execution setIdentifier(String identifier); @ManyToOne @JoinColumn(name = "algorithm") Algorithm getAlgorithm(); Execution setAlgorithm(Algorithm algorithm); @OneToOne(cascade = CascadeType.ALL) @OnDelete(action = OnDeleteAction.CASCADE) ExecutionSetting getExecutionSetting(); Execution setExecutionSetting(ExecutionSetting executionSetting); @Column(name = "begin") long getBegin(); Execution setBegin(long begin); long getEnd(); Execution setEnd(long end); String getConfig(); Execution setConfig(String config); Boolean getCountResult(); Execution setCountResult(Boolean countResult); @ManyToMany(fetch = FetchType.EAGER, cascade = {CascadeType.PERSIST, CascadeType.MERGE}) @Fetch(value = FetchMode.SELECT) @JoinTable( name = "execution_input", joinColumns = {@JoinColumn(name = "execution_id")}, inverseJoinColumns = {@JoinColumn(name = "input_id")} ) List<Input> getInputs(); Execution setInputs(List<Input> inputs); @OneToMany( fetch = FetchType.EAGER, mappedBy = "execution", cascade = CascadeType.ALL ) @OnDelete(action = OnDeleteAction.CASCADE) Set<Result> getResults(); Execution setResults(Set<Result> results); String getHardwareDescription(); Execution setHardwareDescription(String hardwareDescription); String getDescription(); Execution setDescription(String description); boolean isRunning(); Execution setRunning(boolean running); boolean isAborted(); Execution setAborted(boolean aborted); @Override boolean equals(Object o); @Override int hashCode(); @Override int compareTo(Execution other); Execution addInput(Input input); Execution addResult(Result result);  }### Answer:
@Test public void testAddInput() { Execution execution = new Execution(mock(Algorithm.class), 123456789); Input input1 = new Input("input") .setId(42); Input input2 = new Input("input") .setId(23); Collection<Input> actualInputs = execution.getInputs(); assertTrue(actualInputs.isEmpty()); execution.addInput(input1); actualInputs = execution.getInputs(); assertTrue(actualInputs.contains(input1)); execution.addInput(input2); actualInputs = execution.getInputs(); assertEquals(2, actualInputs.size()); assertTrue(actualInputs.contains(input1)); assertTrue(actualInputs.contains(input2)); }