@Test public void handlesDifferentAttributeSeparators() throws Exception { mqttCommandPort.setTopic("test"); int i = 0; for (String s : separators) { mqttCommandPort.setAttributeSeparator(s); receiveMqttMessage("On", "test/" + TEST_ITEM_NAME + s + ATTRIBUTE); i++; verify(testItem, times(i)).setAttributeValue(ATTRIBUTE, "On"); } }
@Test public void handlesBadAttributeSeparators() throws Exception { mqttCommandPort.setTopic("test"); int i = 0; for (String s : badSeparators) { try { mqttCommandPort.setAttributeSeparator(s); assertThat(true, is(false)); } catch (IllegalValueException e) { assertThat(e.getValue(), is(s)); } } }