### Question:
BinCriteria extends Observable implements Observer, ListChangeListener<BinCriteriaElement> { public void setDataTypeKey(String dataTypeKey) { myDataTypeKey = dataTypeKey; setChanged(); notifyObservers(DATA_TYPE_KEY_PROP); } BinCriteria(); ObservableList<BinCriteriaElement> getCriterias(); String getDataTypeKey(); void setDataTypeKey(String dataTypeKey); @Override void update(Observable o, Object arg); @Override void onChanged(javafx.collections.ListChangeListener.Change<? extends BinCriteriaElement> c); static final String CRITERIAS_PROP; static final String DATA_TYPE_KEY_PROP; }### Answer:
@Test public void testSetDataTypeKey() { EasyMockSupport support = new EasyMockSupport(); BinCriteria criteria = new BinCriteria(); Observer observer = support.createMock(Observer.class); observer.update(EasyMock.eq(criteria), EasyMock.cmpEq(BinCriteria.DATA_TYPE_KEY_PROP)); EasyMock.expectLastCall().andAnswer(() -> { assertEquals("layerId1", criteria.getDataTypeKey()); return null; }); support.replayAll(); criteria.addObserver(observer); criteria.setDataTypeKey("layerId1"); support.verifyAll(); }