### Question:
BinCriteriaController implements Comparator<Pair<String, Class<?>>> { public BinCriteriaModel getModel() { return myModel; } BinCriteriaController(DataGroupController ctrl, String dataTypeId, BinCriteria existingCriteria); @Override int compare(Pair<String, Class<?>> o1, Pair<String, Class<?>> o2); BinCriteriaModel getModel();  }### Answer:
@Test public void testCreating() { EasyMockSupport support = new EasyMockSupport(); DataGroupController typeController = createTypeController(support); support.replayAll(); BinCriteriaController controller = new BinCriteriaController(typeController, ourDtiKey, null); BinCriteriaModel model = controller.getModel(); assertNotNull(model.getCriteria()); assertEquals(ourDtiKey, model.getCriteria().getDataTypeKey()); assertEquals(1, model.getCriteria().getCriterias().size()); assertEquals(ourColumn2, model.getCriteria().getCriterias().get(0).getField()); assertEquals(UniqueCriteria.CRITERIA_TYPE, model.getCriteria().getCriterias().get(0).getCriteriaType().getCriteriaType()); assertEquals(2, model.getLayersFields().size()); assertEquals(ourColumn2, model.getLayersFields().get(0).getFirstObject()); assertEquals(String.class, model.getLayersFields().get(0).getSecondObject()); assertEquals("column1", model.getLayersFields().get(1).getFirstObject()); assertEquals(Double.class, model.getLayersFields().get(1).getSecondObject()); support.verifyAll(); }
@Test public void testCreatingEmpty() { EasyMockSupport support = new EasyMockSupport(); DataGroupController typeController = createTypeController(support); support.replayAll(); BinCriteriaController controller = new BinCriteriaController(typeController, ourDtiKey, new BinCriteria()); BinCriteriaModel model = controller.getModel(); assertNotNull(model.getCriteria()); assertEquals(ourDtiKey, model.getCriteria().getDataTypeKey()); assertEquals(1, model.getCriteria().getCriterias().size()); assertEquals(ourColumn2, model.getCriteria().getCriterias().get(0).getField()); assertEquals(UniqueCriteria.CRITERIA_TYPE, model.getCriteria().getCriterias().get(0).getCriteriaType().getCriteriaType()); assertEquals(2, model.getLayersFields().size()); assertEquals(ourColumn2, model.getLayersFields().get(0).getFirstObject()); assertEquals(String.class, model.getLayersFields().get(0).getSecondObject()); assertEquals("column1", model.getLayersFields().get(1).getFirstObject()); assertEquals(Double.class, model.getLayersFields().get(1).getSecondObject()); support.verifyAll(); }
@Test public void testEditing() { EasyMockSupport support = new EasyMockSupport(); DataGroupController typeController = createTypeController(support); support.replayAll(); BinCriteria criteria = new BinCriteria(); BinCriteriaController controller = new BinCriteriaController(typeController, ourDtiKey, criteria); BinCriteriaModel model = controller.getModel(); assertEquals(criteria, model.getCriteria()); assertEquals(2, model.getLayersFields().size()); assertEquals(ourColumn2, model.getLayersFields().get(0).getFirstObject()); assertEquals(String.class, model.getLayersFields().get(0).getSecondObject()); assertEquals("column1", model.getLayersFields().get(1).getFirstObject()); assertEquals(Double.class, model.getLayersFields().get(1).getSecondObject()); support.verifyAll(); }