DeviceRenderer { public static boolean shouldShowSerialNumbers(@NotNull List<IDevice> devices) { Set<String> myNames = new HashSet<String>(); for (IDevice currentDevice : devices) { if (currentDevice.isEmulator()) { continue; } String currentName = getDeviceName(currentDevice); if (myNames.contains(currentName)) { return true; } myNames.add(currentName); } return false; } private  DeviceRenderer(); static void renderDeviceName(@NotNull IDevice d,
                                      @NotNull DeviceNameProperties deviceProperties,
                                      @NotNull ColoredTextContainer component,
                                      boolean showSerialNumber); static void renderDeviceName(@NotNull IDevice d,
                                      @NotNull DeviceNameProperties deviceNameProperties,
                                      @NotNull ColoredTextContainer component,
                                      boolean showSerialNumber,
                                      @Nullable AvdManager avdManager); static boolean shouldShowSerialNumbers(@NotNull List<IDevice> devices);  }
@Test public void showSerialFalseForEmulator() throws Exception { List<IDevice> devices = new ArrayList<>(); IDevice d1 = createDevice(true, null, manufacturer, model, buildVersion, apiLevel, "123", IDevice.DeviceState.ONLINE); devices.add(d1); devices.add(createDevice(true, null, manufacturer, model, buildVersion, apiLevel, "1234", IDevice.DeviceState.ONLINE)); assertFalse(DeviceRenderer.shouldShowSerialNumbers(devices)); }
@Test public void showSerialTrueForDuplicate() throws Exception { List<IDevice> devices = new ArrayList<>(); IDevice d1 = createDevice(false, null, manufacturer, model, buildVersion, apiLevel, "123", IDevice.DeviceState.ONLINE); devices.add(d1); devices.add(createDevice(false, null, manufacturer, model, buildVersion, apiLevel, "1234", IDevice.DeviceState.ONLINE)); assertTrue(DeviceRenderer.shouldShowSerialNumbers(devices)); }