ConstructionHeuristicForm implements IsElement { public void setModel(ConstructionHeuristicPhaseConfigModel model) { this.model = model; if (model.getConstructionHeuristicType() == null) { model.setConstructionHeuristicType(ConstructionHeuristicType.FIRST_FIT); } view.setSelectedConstructionHeuristicType(model.getConstructionHeuristicType().name()); if (model.getEntitySorterManner() == null) { model.setEntitySorterManner(EntitySorterManner.NONE); } view.setSelectedEntitySorterManner(model.getEntitySorterManner().name()); } @Inject  ConstructionHeuristicForm(final ConstructionHeuristicFormView view); void setPhaseConfigForm(PhaseConfigForm phaseConfigForm); void onConstructionHeuristicTypeSelected(String constructionHeuristicType); void onEntitySorterMannerSelected(String entitySorterManner); void onConstructionHeuristicRemoved(); ConstructionHeuristicPhaseConfigModel getModel(); void setModel(ConstructionHeuristicPhaseConfigModel model); @Override HTMLElement getElement();  }
@Test public void setModelNullAttribute() { when(model.getConstructionHeuristicType()).thenReturn(null).thenReturn(ConstructionHeuristicType.FIRST_FIT_DECREASING); when(model.getEntitySorterManner()).thenReturn(null).thenReturn(EntitySorterManner.DECREASING_DIFFICULTY_IF_AVAILABLE); constructionHeuristicForm.setModel(model); verify(model).setConstructionHeuristicType(ConstructionHeuristicType.FIRST_FIT); verify(model).setEntitySorterManner(EntitySorterManner.NONE); }
@Test public void setModelNonNullAttribute() { when(model.getConstructionHeuristicType()).thenReturn(ConstructionHeuristicType.FIRST_FIT_DECREASING); when(model.getEntitySorterManner()).thenReturn(EntitySorterManner.DECREASING_DIFFICULTY_IF_AVAILABLE); constructionHeuristicForm.setModel(model); verify(model, times(0)).setConstructionHeuristicType(ConstructionHeuristicType.FIRST_FIT); verify(model, times(0)).setEntitySorterManner(EntitySorterManner.NONE); }