SnapshotActionGroup extends ActionGroup { @NotNull private static String getText(@NotNull List<Device> devices) { String name = getProperty(devices, Device::getName); assert name != null; return Devices.getText(name, getProperty(devices, Device::getValidityReason)); } SnapshotActionGroup(@NotNull List<Device> devices, @NotNull DeviceAndSnapshotComboBoxAction comboBoxAction, @NotNull Project project); @NotNull @Override AnAction[] getChildren(@Nullable AnActionEvent event); @Override boolean equals(@Nullable Object object); @Override int hashCode();  }
@Test public void snapshotActionGroupDevicesHaveValidityReasons() { Device device1 = new VirtualDevice.Builder() .setName("Pixel 3 API 29") .setValidityReason("Missing system image") .setKey(new Key("Pixel_3_API_29/snap_2019-09-27_15-48-09")) .setAndroidDevice(Mockito.mock(AndroidDevice.class)) .build(); Device device2 = new VirtualDevice.Builder() .setName("Pixel 3 API 29") .setValidityReason("Missing system image") .setKey(new Key("Pixel_3_API_29/snap_2019-09-27_15-49-04")) .setAndroidDevice(Mockito.mock(AndroidDevice.class)) .build(); List<Device> devices = Arrays.asList(device1, device2); AnAction action = new SnapshotActionGroup(devices, myComboBoxAction, myProject); assertEquals("Pixel 3 API 29 (Missing system image)", action.getTemplatePresentation().getText()); }