Timepoint implements Parcelable, Comparable<Timepoint> { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Timepoint timepoint = (Timepoint) o; return hashCode() == timepoint.hashCode(); } Timepoint(Timepoint time);  Timepoint(@IntRange(from=0, to=23) int hour,
                     @IntRange(from=0, to=59) int minute,
                     @IntRange(from=0, to=59) int second);  Timepoint(@IntRange(from=0, to=23) int hour,
                     @IntRange(from=0, to=59) int minute);  Timepoint(@IntRange(from=0, to=23) int hour);  Timepoint(Parcel in); @IntRange(from=0, to=23) int getHour(); @IntRange(from=0, to=59) int getMinute(); @IntRange(from=0, to=59) int getSecond(); boolean isAM(); boolean isPM(); void setAM(); void setPM(); void add(TYPE type, int value); int get(@NonNull TYPE type); int toSeconds(); @Override int hashCode(); @Override boolean equals(Object o); boolean equals(@Nullable Timepoint time, @NonNull TYPE resolution); @Override int compareTo(@NonNull Timepoint t); @Override void writeToParcel(Parcel out, int flags); @Override int describeContents(); @Override String toString(); static final Parcelable.Creator<Timepoint> CREATOR; }
@Test public void equalsShouldReturnTrueWhenInputsAreEqualWithSecondsResolution() { Timepoint timepoint1 = new Timepoint(1, 14, 15); Timepoint timepoint2 = new Timepoint(1, 14, 15); Assert.assertTrue(timepoint1.equals(timepoint2, Timepoint.TYPE.SECOND)); }
@Test public void equalsShouldReturnFalseWhenInputsDifferWithSecondsResolution() { Timepoint timepoint1 = new Timepoint(1, 14, 15); Timepoint timepoint2 = new Timepoint(1, 14, 16); Assert.assertFalse(timepoint1.equals(timepoint2, Timepoint.TYPE.SECOND)); }
@Test public void equalsShouldIgnoreSecondsWithMinuteResolution() { Timepoint timepoint1 = new Timepoint(1, 14, 15); Timepoint timepoint2 = new Timepoint(1, 14, 16); Assert.assertTrue(timepoint1.equals(timepoint2, Timepoint.TYPE.MINUTE)); }
@Test public void equalsShouldReturnFalseWhenInputsDifferWithMinuteResolution() { Timepoint timepoint1 = new Timepoint(1, 14, 15); Timepoint timepoint2 = new Timepoint(1, 15, 15); Assert.assertFalse(timepoint1.equals(timepoint2, Timepoint.TYPE.MINUTE)); }
@Test public void equalsShouldIgnoreSecondsWithHourResolution() { Timepoint timepoint1 = new Timepoint(1, 14, 15); Timepoint timepoint2 = new Timepoint(1, 14, 16); Assert.assertTrue(timepoint1.equals(timepoint2, Timepoint.TYPE.HOUR)); }
@Test public void equalsShouldIgnoreMinutesWithHourResolution() { Timepoint timepoint1 = new Timepoint(1, 14, 15); Timepoint timepoint2 = new Timepoint(1, 15, 16); Assert.assertTrue(timepoint1.equals(timepoint2, Timepoint.TYPE.HOUR)); }
@Test public void equalsShouldReturnFalseWhenInputsDifferWithHourResolution() { Timepoint timepoint1 = new Timepoint(1, 14, 15); Timepoint timepoint2 = new Timepoint(2, 14, 15); Assert.assertFalse(timepoint1.equals(timepoint2, Timepoint.TYPE.HOUR)); }