private <T> void resetCommunicatorExpectingSingleBroadcast(
      Capture<T> message, Capture<MessageSubject> subject, Capture<Function<T, byte[]>> encoder) {

    message.reset();
    subject.reset();
    encoder.reset();
    reset(clusterCommunicator);
    clusterCommunicator.broadcast(capture(message), capture(subject), capture(encoder));
    expectLastCall().once();
    replay(clusterCommunicator);
  }
 private void putDevice(DeviceId deviceId, String swVersion, SparseAnnotations... annotations) {
   DeviceDescription description =
       new DefaultDeviceDescription(
           deviceId.uri(), SWITCH, MFR, HW, swVersion, SN, CID, annotations);
   reset(clusterCommunicator);
   clusterCommunicator.<InternalDeviceEvent>broadcast(
       anyObject(InternalDeviceEvent.class),
       anyObject(MessageSubject.class),
       anyObject(Function.class));
   expectLastCall().anyTimes();
   replay(clusterCommunicator);
   deviceStore.createOrUpdateDevice(PID, deviceId, description);
   verify(clusterCommunicator);
 }