Loading core/tests/coretests/src/android/app/timezonedetector/ParcelableTestSupport.java→core/tests/coretests/src/android/app/time/ParcelableTestSupport.java +9 −2 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ * limitations under the License. */ package android.app.timezonedetector; package android.app.time; import static org.junit.Assert.assertEquals; Loading Loading @@ -48,6 +48,13 @@ public final class ParcelableTestSupport { } public static <T extends Parcelable> void assertRoundTripParcelable(T instance) { assertEquals(instance, roundTripParcelable(instance)); assertEqualsAndHashCode(instance, roundTripParcelable(instance)); } /** Asserts that the objects are equal and return identical hash codes. */ public static void assertEqualsAndHashCode(Object one, Object two) { assertEquals(one, two); assertEquals(two, one); assertEquals(one.hashCode(), two.hashCode()); } } core/tests/coretests/src/android/app/time/TimeCapabilitiesTest.java +5 −4 Original line number Diff line number Diff line Loading @@ -21,7 +21,8 @@ import static android.app.time.Capabilities.CAPABILITY_NOT_ALLOWED; import static android.app.time.Capabilities.CAPABILITY_NOT_APPLICABLE; import static android.app.time.Capabilities.CAPABILITY_NOT_SUPPORTED; import static android.app.time.Capabilities.CAPABILITY_POSSESSED; import static android.app.timezonedetector.ParcelableTestSupport.assertRoundTripParcelable; import static android.app.time.ParcelableTestSupport.assertEqualsAndHashCode; import static android.app.time.ParcelableTestSupport.assertRoundTripParcelable; import static com.google.common.truth.Truth.assertThat; Loading Loading @@ -55,7 +56,7 @@ public class TimeCapabilitiesTest { { TimeCapabilities one = builder1.build(); TimeCapabilities two = builder2.build(); assertEquals(one, two); assertEqualsAndHashCode(one, two); } builder2.setConfigureAutoDetectionEnabledCapability(CAPABILITY_NOT_ALLOWED); Loading @@ -69,7 +70,7 @@ public class TimeCapabilitiesTest { { TimeCapabilities one = builder1.build(); TimeCapabilities two = builder2.build(); assertEquals(one, two); assertEqualsAndHashCode(one, two); } builder2.setSetManualTimeCapability(CAPABILITY_NOT_ALLOWED); Loading @@ -83,7 +84,7 @@ public class TimeCapabilitiesTest { { TimeCapabilities one = builder1.build(); TimeCapabilities two = builder2.build(); assertEquals(one, two); assertEqualsAndHashCode(one, two); } } Loading core/tests/coretests/src/android/app/time/TimeStateTest.java +2 −6 Original line number Diff line number Diff line Loading @@ -16,7 +16,8 @@ package android.app.time; import static android.app.timezonedetector.ParcelableTestSupport.assertRoundTripParcelable; import static android.app.time.ParcelableTestSupport.assertEqualsAndHashCode; import static android.app.time.ParcelableTestSupport.assertRoundTripParcelable; import static android.app.timezonedetector.ShellCommandTestSupport.createShellCommandWithArgsAndOptions; import static org.junit.Assert.assertEquals; Loading Loading @@ -52,11 +53,6 @@ public class TimeStateTest { assertNotEquals(time1False_1, time2False); } private static void assertEqualsAndHashCode(Object one, Object two) { assertEquals(one, two); assertEquals(one.hashCode(), two.hashCode()); } @Test public void testParceling() { UnixEpochTime time = new UnixEpochTime(1, 2); Loading core/tests/coretests/src/android/app/time/TimeZoneCapabilitiesTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ package android.app.time; import static android.app.time.Capabilities.CAPABILITY_NOT_ALLOWED; import static android.app.time.Capabilities.CAPABILITY_POSSESSED; import static android.app.timezonedetector.ParcelableTestSupport.assertRoundTripParcelable; import static android.app.time.ParcelableTestSupport.assertRoundTripParcelable; import static com.google.common.truth.Truth.assertThat; Loading core/tests/coretests/src/android/app/time/TimeZoneStateTest.java +2 −6 Original line number Diff line number Diff line Loading @@ -16,7 +16,8 @@ package android.app.time; import static android.app.timezonedetector.ParcelableTestSupport.assertRoundTripParcelable; import static android.app.time.ParcelableTestSupport.assertEqualsAndHashCode; import static android.app.time.ParcelableTestSupport.assertRoundTripParcelable; import static android.app.timezonedetector.ShellCommandTestSupport.createShellCommandWithArgsAndOptions; import static org.junit.Assert.assertEquals; Loading Loading @@ -52,11 +53,6 @@ public class TimeZoneStateTest { assertNotEquals(zone1False_1, zone2False); } private static void assertEqualsAndHashCode(Object one, Object two) { assertEquals(one, two); assertEquals(one.hashCode(), two.hashCode()); } @Test public void testParceling() { assertRoundTripParcelable(new TimeZoneState("Europe/London", true)); Loading Loading
core/tests/coretests/src/android/app/timezonedetector/ParcelableTestSupport.java→core/tests/coretests/src/android/app/time/ParcelableTestSupport.java +9 −2 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ * limitations under the License. */ package android.app.timezonedetector; package android.app.time; import static org.junit.Assert.assertEquals; Loading Loading @@ -48,6 +48,13 @@ public final class ParcelableTestSupport { } public static <T extends Parcelable> void assertRoundTripParcelable(T instance) { assertEquals(instance, roundTripParcelable(instance)); assertEqualsAndHashCode(instance, roundTripParcelable(instance)); } /** Asserts that the objects are equal and return identical hash codes. */ public static void assertEqualsAndHashCode(Object one, Object two) { assertEquals(one, two); assertEquals(two, one); assertEquals(one.hashCode(), two.hashCode()); } }
core/tests/coretests/src/android/app/time/TimeCapabilitiesTest.java +5 −4 Original line number Diff line number Diff line Loading @@ -21,7 +21,8 @@ import static android.app.time.Capabilities.CAPABILITY_NOT_ALLOWED; import static android.app.time.Capabilities.CAPABILITY_NOT_APPLICABLE; import static android.app.time.Capabilities.CAPABILITY_NOT_SUPPORTED; import static android.app.time.Capabilities.CAPABILITY_POSSESSED; import static android.app.timezonedetector.ParcelableTestSupport.assertRoundTripParcelable; import static android.app.time.ParcelableTestSupport.assertEqualsAndHashCode; import static android.app.time.ParcelableTestSupport.assertRoundTripParcelable; import static com.google.common.truth.Truth.assertThat; Loading Loading @@ -55,7 +56,7 @@ public class TimeCapabilitiesTest { { TimeCapabilities one = builder1.build(); TimeCapabilities two = builder2.build(); assertEquals(one, two); assertEqualsAndHashCode(one, two); } builder2.setConfigureAutoDetectionEnabledCapability(CAPABILITY_NOT_ALLOWED); Loading @@ -69,7 +70,7 @@ public class TimeCapabilitiesTest { { TimeCapabilities one = builder1.build(); TimeCapabilities two = builder2.build(); assertEquals(one, two); assertEqualsAndHashCode(one, two); } builder2.setSetManualTimeCapability(CAPABILITY_NOT_ALLOWED); Loading @@ -83,7 +84,7 @@ public class TimeCapabilitiesTest { { TimeCapabilities one = builder1.build(); TimeCapabilities two = builder2.build(); assertEquals(one, two); assertEqualsAndHashCode(one, two); } } Loading
core/tests/coretests/src/android/app/time/TimeStateTest.java +2 −6 Original line number Diff line number Diff line Loading @@ -16,7 +16,8 @@ package android.app.time; import static android.app.timezonedetector.ParcelableTestSupport.assertRoundTripParcelable; import static android.app.time.ParcelableTestSupport.assertEqualsAndHashCode; import static android.app.time.ParcelableTestSupport.assertRoundTripParcelable; import static android.app.timezonedetector.ShellCommandTestSupport.createShellCommandWithArgsAndOptions; import static org.junit.Assert.assertEquals; Loading Loading @@ -52,11 +53,6 @@ public class TimeStateTest { assertNotEquals(time1False_1, time2False); } private static void assertEqualsAndHashCode(Object one, Object two) { assertEquals(one, two); assertEquals(one.hashCode(), two.hashCode()); } @Test public void testParceling() { UnixEpochTime time = new UnixEpochTime(1, 2); Loading
core/tests/coretests/src/android/app/time/TimeZoneCapabilitiesTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ package android.app.time; import static android.app.time.Capabilities.CAPABILITY_NOT_ALLOWED; import static android.app.time.Capabilities.CAPABILITY_POSSESSED; import static android.app.timezonedetector.ParcelableTestSupport.assertRoundTripParcelable; import static android.app.time.ParcelableTestSupport.assertRoundTripParcelable; import static com.google.common.truth.Truth.assertThat; Loading
core/tests/coretests/src/android/app/time/TimeZoneStateTest.java +2 −6 Original line number Diff line number Diff line Loading @@ -16,7 +16,8 @@ package android.app.time; import static android.app.timezonedetector.ParcelableTestSupport.assertRoundTripParcelable; import static android.app.time.ParcelableTestSupport.assertEqualsAndHashCode; import static android.app.time.ParcelableTestSupport.assertRoundTripParcelable; import static android.app.timezonedetector.ShellCommandTestSupport.createShellCommandWithArgsAndOptions; import static org.junit.Assert.assertEquals; Loading Loading @@ -52,11 +53,6 @@ public class TimeZoneStateTest { assertNotEquals(zone1False_1, zone2False); } private static void assertEqualsAndHashCode(Object one, Object two) { assertEquals(one, two); assertEquals(one.hashCode(), two.hashCode()); } @Test public void testParceling() { assertRoundTripParcelable(new TimeZoneState("Europe/London", true)); Loading