Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 84dd7bc1 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Tidy up changes"

parents 962ca6ca 161e9f1b
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@
 * limitations under the License.
 */

package android.app.timezonedetector;
package android.app.time;

import static org.junit.Assert.assertEquals;

@@ -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());
    }
}
+5 −4
Original line number Diff line number Diff line
@@ -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;

@@ -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);
@@ -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);
@@ -83,7 +84,7 @@ public class TimeCapabilitiesTest {
        {
            TimeCapabilities one = builder1.build();
            TimeCapabilities two = builder2.build();
            assertEquals(one, two);
            assertEqualsAndHashCode(one, two);
        }
    }

+2 −6
Original line number Diff line number Diff line
@@ -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;
@@ -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);
+1 −1
Original line number Diff line number Diff line
@@ -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;

+2 −6
Original line number Diff line number Diff line
@@ -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;
@@ -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