@Test
public void testPublisherCallsCorrectDoPublishWhenNoKeysAreProvidedAndMapIsNotEmpty() {

  final double expected = Math.PI;
  boolean[] doPublishSingleValueWasCalled = {false};
  final DoubleMapPublisher doubleMapPublisher =
      new DoubleMapPublisher(new HashSet<>()) {
        @Override
        protected void doPublish() {
          fail(SHOULD_NOT_HAVE_BEEN_CALLED);
        }
        @Override
        protected void doPublish(Map<String, Double> publishMap) {
          fail(SHOULD_NOT_HAVE_BEEN_CALLED);
        }
        @Override
        protected void doPublishSingle(Double value) {
          doPublishSingleValueWasCalled[0] = true;
          assertEquals("Should have published the expected value", expected, value, 0.001);
        }
      };
  doubleMapPublisher.setName("Don't care");
  doubleMapPublisher.publish(ImmutableMap.of("", expected));
  assertTrue("doPublish with a single value should have been called",
      doPublishSingleValueWasCalled[0]);
}