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

Commit 1aa203e5 authored by Geoffrey Boullanger's avatar Geoffrey Boullanger
Browse files

Introduce new MobileCountries test method for unit tests

Bug: 393349646
Flag: EXEMPT will be used behind flag com.android.internal.telephony.flags.allow_multi_country_mcc
Change-Id: I0fb35fc7aae404cfdd6739a84f2b56ab84fea4a0
parent 5153bd40
Loading
Loading
Loading
Loading
+15 −2
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package android.timezone;
import android.annotation.NonNull;
import android.annotation.Nullable;

import com.android.internal.annotations.VisibleForTesting;
import java.util.Objects;
import java.util.Set;

@@ -27,17 +28,29 @@ import java.util.Set;
 *
 * @hide
 */
public class MobileCountries {
public final class MobileCountries {

    @NonNull
    private final com.android.i18n.timezone.MobileCountries mDelegate;

    /** Create a {@link MobileCountries} entity. This can be used for test networks. */
    /**
     * Create a {@link MobileCountries} entity. This can be used for test networks (i.e. integration
     * tests).
     */
    public static MobileCountries createTestCell(String mcc) {
        return new MobileCountries(
                com.android.i18n.timezone.MobileCountries.create(mcc, Set.of(""), ""));
    }

    /** Create a {@link MobileCountries} entity for tests (i.e. unit tests). */
    @VisibleForTesting
    public static MobileCountries createForTest(
            String mcc, String mnc, Set<String> countryIsoCodes, String defaultCountryIsoCode) {
        return new MobileCountries(
                com.android.i18n.timezone.MobileCountries.create(
                        mcc, mnc, countryIsoCodes, defaultCountryIsoCode));
    }

    MobileCountries(@NonNull com.android.i18n.timezone.MobileCountries delegate) {
        mDelegate = Objects.requireNonNull(delegate);
    }