@NonNull private static Device generateMockDevice() { Device device = new Device(); device.setSdkName("appcenter.android"); device.setSdkVersion(String.format(Locale.ENGLISH, "%d.%d.%d", (RANDOM.nextInt(5) + 1), RANDOM.nextInt(10), RANDOM.nextInt(100))); device.setModel("S5"); device.setOemName("HTC"); device.setOsName("Android"); device.setOsVersion(String.format(Locale.ENGLISH, "%d.%d.%d", (RANDOM.nextInt(5) + 1), RANDOM.nextInt(10), RANDOM.nextInt(100))); device.setOsBuild("LMY47X"); device.setOsApiLevel(RANDOM.nextInt(9) + 15); device.setLocale("en_US"); device.setTimeZoneOffset(RANDOM.nextInt(52) * 30 - 720); device.setScreenSize(String.format(Locale.ENGLISH, "%dx%d", (RANDOM.nextInt(4) + 1) * 1000, (RANDOM.nextInt(10) + 1) * 100)); device.setAppVersion(String.format(Locale.ENGLISH, "%d.%d.%d", (RANDOM.nextInt(5) + 1), RANDOM.nextInt(10), RANDOM.nextInt(100))); device.setAppBuild(Integer.toString(RANDOM.nextInt(1000) + 1)); device.setAppNamespace("com.microsoft.unittest"); device.setWrapperSdkVersion("1.2.3.4"); device.setWrapperSdkName("ReactNative"); device.setLiveUpdateReleaseLabel("2.0.3-beta2"); device.setLiveUpdateDeploymentKey("staging"); device.setLiveUpdatePackageHash("aa896f791b26a7f464c0f62b0ba69f2b"); return device; } }
device.setWrapperRuntimeVersion(sWrapperSdk.getWrapperRuntimeVersion()); device.setLiveUpdateReleaseLabel(sWrapperSdk.getLiveUpdateReleaseLabel()); device.setLiveUpdateDeploymentKey(sWrapperSdk.getLiveUpdateDeploymentKey()); device.setLiveUpdatePackageHash(sWrapperSdk.getLiveUpdatePackageHash());
device2.setWrapperRuntimeVersion(null); device2.setLiveUpdateReleaseLabel(null); device2.setLiveUpdateDeploymentKey(null); device2.setLiveUpdatePackageHash(null); assertEquals(device, device2);
a.setLiveUpdateDeploymentKey("a"); checkNotEquals(a, b); b.setLiveUpdateDeploymentKey("b"); checkNotEquals(a, b); b.setLiveUpdateDeploymentKey("a"); checkEquals(a, b);