@Test
public void shouldSwitchBrightnessFromMinimalValueToPreviousStateWhenPresent() {

    // given: brightness controller which does not have previous state yet
    val backlightSwitch = givenDefaultBacklightSwitch();
    val settings = givenSettingsWithBrightnessValue(30);
    val controller = new BacklightSwitch.BacklightController(settings, backlightSwitch);
    // when: switching state, brightness value = 30 will be stored as previous state
    controller.onClick(mock(View.class));
    // then
    then(settings).should().setScreenBrightnessTo(BRIGHTNESS_MIN);
    // when: switching state once again, brightness will be set to previous state
    controller.onClick(mock(View.class));
    // then
    then(settings).should().setScreenBrightnessTo(30);
    then(backlightSwitch).should().setImageBasedOn(30);
}