@Test
  public void callsCorrectAction() throws Exception {
    mqttCommandPort.setTopic("test");
    receiveMqttMessage("On", "test/" + TEST_ITEM_NAME);

    verify(testItem).callAction("On");
  }
  @Test
  public void setsAttributeValue() throws Exception {
    mqttCommandPort.setTopic("test");
    receiveMqttMessage("On", "test/" + TEST_ITEM_NAME + ATTRIBUTE_SEPARATOR + ATTRIBUTE);

    verify(testItem).setAttributeValue(ATTRIBUTE, "On");
  }
  @Test
  public void findsCorrectHomeItemForActionWithThreeLevelTopic() throws Exception {
    mqttCommandPort.setTopic("test/more/levels");
    receiveMqttMessage("On", "test/more/levels/" + TEST_ITEM_NAME);

    verify(service).openInstance(TEST_ITEM_NAME);
  }
 @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));
     }
   }
 }