DoubleStatisticBinding implements StatisticBinding { @Override public long longValue() { return (long) statistics.getDouble(statId); } DoubleStatisticBinding(Statistics statistics, int statId); @Override void add(double amount); @Override double doubleValue(); @Override long longValue();  }
@Test public void longValue_returnsDoubleStatValueAsLong() { int statId = 27; StatisticBinding binding = new DoubleStatisticBinding(statistics, statId); when(statistics.getDouble(statId)).thenReturn(2341.0); assertThat(binding.longValue()) .isEqualTo(2341L); }