### Question:
SmartThrottleFlag { public int getPortionIn() { final LocalDate now = LocalDate.now(); if (startDate.isAfter(now)) { return 0; } long daysPast = DAYS.between(startDate, now); long totalIncrement = daysPast * dailyIncrement; long currentPortionIn = initialPortionIn + totalIncrement; return Math.min((int) currentPortionIn, 100); } SmartThrottleFlag(int initialPortionIn, LocalDate startDate, int dailyIncrement); int getPortionIn();  }### Answer:
@Test public void flagIsZeroBeforeStartDate() { SmartThrottleFlag smartThrottleFlag = new SmartThrottleFlag(5, tomorrow, 10); assertThat(smartThrottleFlag.getPortionIn(), is(0)); }
@Test public void flagIsInitialPortionAtStartDate() { SmartThrottleFlag smartThrottleFlag = new SmartThrottleFlag(5, today, 10); assertThat(smartThrottleFlag.getPortionIn(), is(5)); }
@Test public void flagIsInitialPlusOneIncrementOnDayAfterStartDate() { SmartThrottleFlag smartThrottleFlag = new SmartThrottleFlag(5, yesterday, 10); assertThat(smartThrottleFlag.getPortionIn(), is(15)); }
@Test public void flagMaxesOutAt100AfterEnoughDaysHavePassed() { SmartThrottleFlag smartThrottleFlag = new SmartThrottleFlag(5, lastYear, 10); assertThat(smartThrottleFlag.getPortionIn(), is(100)); }