@Override
    public Metrics toDay() {
        MaxFunction metrics = (MaxFunction) createNew();
        metrics.setEntityId(getEntityId());
        metrics.setTimeBucket(toTimeBucketInDay());
        metrics.setServiceId(getServiceId());
        metrics.setValue(getValue());
        return metrics;
    }
@Test
    public void testToDay() {
        function.setTimeBucket(TimeBucket.getMinuteTimeBucket(System.currentTimeMillis()));
        function.accept(MeterEntity.newService("service-test", Layer.GENERAL), LARGE_VALUE);
        function.accept(MeterEntity.newService("service-test", Layer.GENERAL), SMALL_VALUE);
        function.calculate();

        final MaxFunction dayFunction = (MaxFunction) function.toDay();
        dayFunction.calculate();
        assertThat(dayFunction.getValue()).isEqualTo(LARGE_VALUE);
    }