// Copyright 2013 Square, Inc.
package org.assertj.android.api.widget;

import android.widget.TimePicker;

import static org.assertj.core.api.Assertions.assertThat;

public class TimePickerAssert extends AbstractFrameLayoutAssert<TimePickerAssert, TimePicker> {
  public TimePickerAssert(TimePicker actual) {
    super(actual, TimePickerAssert.class);
  }

  public TimePickerAssert hasCurrentHour(Integer hour) {
    isNotNull();
    Integer actualHour = actual.getCurrentHour();
    assertThat(actualHour) //
        .overridingErrorMessage("Expected current hour <%s> but was <%s>.", hour, actualHour) //
        .isEqualTo(hour);
    return this;
  }

  public TimePickerAssert hasCurrentMinute(Integer minute) {
    isNotNull();
    Integer actualMinute = actual.getCurrentMinute();
    assertThat(actualMinute) //
        .overridingErrorMessage("Expected current minute <%s> but was <%s>.", minute,
            actualMinute) //
        .isEqualTo(minute);
    return this;
  }

  public TimePickerAssert isIn24HourView() {
    isNotNull();
    assertThat(actual.is24HourView()) //
        .overridingErrorMessage("Expected to be in 24 hour view but was not.") //
        .isTrue();
    return this;
  }

  public TimePickerAssert isNotIn24HourView() {
    isNotNull();
    assertThat(actual.is24HourView()) //
        .overridingErrorMessage("Expected to not be in 24 hour view but was.") //
        .isFalse();
    return this;
  }
}

@@ -84,27 +84,156 @@
 oid.
-widget.TimePicker;%0A
+annotation.TargetApi;%0Aimport android.support.annotation.IntRange;%0Aimport android.widget.TimePicker;%0A%0Aimport static android.os.Build.VERSION_CODES.M;
 %0Aimp
@@ -1099,32 +1099,699 @@
 turn this;%0A  %7D%0A%0A
+  @TargetApi(M)%0A  public TimePickerAssert hasHour(@IntRange(from = 0, to = 23) int hour) %7B%0A    isNotNull();%0A    int actualHour = actual.getHour();%0A    assertThat(actualHour) //%0A        .overridingErrorMessage(%22Expected hour %3C%25s%3E but was %3C%25s%3E.%22, hour,%0A            actualHour) //%0A        .isEqualTo(hour);%0A    return this;%0A  %7D%0A%0A  @TargetApi(M)%0A  public TimePickerAssert hasMinute(@IntRange(from = 0, to = 59) int minute) %7B%0A    isNotNull();%0A    int actualMinute = actual.getMinute();%0A    assertThat(actualMinute)%0A        .overridingErrorMessage(%22Expected minute %3C%25s%3E but was %3C%25s%3E.%22, minute,%0A            actualMinute) //%0A        .isEqualTo(minute);%0A    return this;%0A  %7D%0A%0A
   public TimePic

Add API 23 assertions to TimePickerAssert