@Test
@SuppressWarnings("unchecked")
public void testPublishSimpleReportReturnsExpectedValues() {

  final String publisherName = "PUBLISH QUACKERY!";
  final boolean[] publishNameChangedRan = {false};
  final boolean[] doPublishRan = {false};
  class TestMapNetworkPublisher<T> extends MapNetworkPublisher<T> {
    public TestMapNetworkPublisher(Set keys) {
      super(keys);
    }
    @Override
    protected void publishNameChanged(Optional oldName, String newName) {
      assertEquals("Name was not what was expected", newName, publisherName);
      assertFalse("There was an old name when there shouldn't have been", oldName.isPresent());
      publishNameChangedRan[0] = true;
    }
    @Override
    public void close() {
      fail("Close should not have run!");
    }
    @Override
    protected void doPublish() {
      fail("This should not have run");
    }
    @Override
    protected void doPublish(Map<String, T> publishMap) {
      assertTrue("The first key didn't get passed to the map",
          publishMap.containsKey(SimpleReport.KEY_1));
      assertTrue("The second key didn't get passed to the map",
          publishMap.containsKey(SimpleReport.KEY_2));
      doPublishRan[0] = true;
    }
    @Override
    protected void doPublishSingle(T value) {
      fail("This should not have run");
    }
  }
  // Cannot be method reference due to JDK/javac bug 8144673
  final MapNetworkPublisherFactory factory = new MapNetworkPublisherFactory() {
    @Override
    public <T> MapNetworkPublisher<T> create(Set<String> keys) {
      return new TestMapNetworkPublisher<>(keys);
    }
  };
  final TestPublishAnnotatedOperation<SimpleReport> testPublishAnnotatedOperation = new
      TestPublishAnnotatedOperation<>(SimpleReport.class, factory);
  final List<InputSocket> inputSockets = testPublishAnnotatedOperation.getInputSockets();
  inputSockets.get(0).setValue(new SimpleReport());
  inputSockets.get(1).setValue(publisherName);
  testPublishAnnotatedOperation.perform();
  assertTrue("publishNameChanged never ran", publishNameChangedRan[0]);
  assertTrue("doPublish never ran", doPublishRan[0]);
}