### Question:
ModelDiff { public List<String> getUpdateMaql() { if (updateScripts.isEmpty()) { return emptyList(); } UpdateScript chosenScript; if ((chosenScript = getUpdateScriptByFlags(true, false)) != null) { return unmodifiableList(chosenScript.getMaqlChunks()); } if ((chosenScript = getUpdateScriptByFlags(false, false)) != null) { return unmodifiableList(chosenScript.getMaqlChunks()); } if ((chosenScript = getUpdateScriptByFlags(true, true)) != null) { return unmodifiableList(chosenScript.getMaqlChunks()); } return unmodifiableList(updateScripts.get(0).getMaqlChunks()); } @JsonCreator  ModelDiff(@JsonProperty("updateScripts") List<UpdateScript> updateScripts);   ModelDiff(UpdateScript... updateScripts); List<String> getUpdateMaql(); @Override String toString();  }### Answer:
@Test public void testGetUpdateMaqls() throws Exception { final ModelDiff diff = new ModelDiff(new UpdateScript(true, false, "maql1", "maql2")); assertThat(diff.getUpdateMaql(), hasSize(2)); assertThat(diff.getUpdateMaql(), contains("maql1", "maql2")); }
@Test public void testGetUpdateMaqlsReturnsBest() throws Exception { final ModelDiff diff = new ModelDiff( new UpdateScript(false, false, "maql1"), new UpdateScript(true, false, "maql2") ); assertThat(diff.getUpdateMaql(), hasSize(1)); assertThat(diff.getUpdateMaql(), contains("maql2")); }
@Test public void testGetUpdateMaqlsReturnsNotWorst() throws Exception { final ModelDiff diff = new ModelDiff( new UpdateScript(false, true, "maql1"), new UpdateScript(false, false, "maql2") ); assertThat(diff.getUpdateMaql(), hasSize(1)); assertThat(diff.getUpdateMaql(), contains("maql2")); }
@Test public void testGetUpdateMaqlsNoPreserveData() throws Exception { final ModelDiff diff = new ModelDiff(new UpdateScript(false, false, "maql")); assertThat(diff.getUpdateMaql(), hasSize(1)); assertThat(diff.getUpdateMaql().get(0), equalTo("maql")); }
@Test public void testGetUpdateMaqlsNoUpdateScript() throws Exception { final ModelDiff diff = new ModelDiff(Collections.emptyList()); assertThat(diff.getUpdateMaql(), hasSize(0)); }
@Test public void testGetUpdateMaqlsNoMaqlInUpdateScript() throws Exception { final ModelDiff diff = new ModelDiff(new UpdateScript(true, false, Collections.emptyList())); assertThat(diff.getUpdateMaql(), hasSize(0)); }