DeployTargetContext implements JDOMExternalizable { @NotNull public DeployTargetProvider getCurrentDeployTargetProvider() { Object mode = getTargetSelectionMode().name(); Optional<DeployTargetProvider> optionalProvider = myDeployTargetProviders.stream() .filter(provider -> provider.getId().equals(mode)) .findFirst(); return optionalProvider.orElseThrow(AssertionError::new); } DeployTargetContext(); @VisibleForTesting  DeployTargetContext(@NotNull Collection<DeployTargetProvider> deployTargetProviders); @NotNull List<DeployTargetProvider> getApplicableDeployTargetProviders(boolean testConfiguration); @NotNull DeployTargetProvider getCurrentDeployTargetProvider(); @NotNull Map<String, DeployTargetState> getDeployTargetStates(); @NotNull DeployTargetState getCurrentDeployTargetState(); @NotNull DeployTargetState getDeployTargetState(@NotNull DeployTargetProvider target); void setTargetSelectionMode(@NotNull TargetSelectionMode mode); void setTargetSelectionMode(@NotNull DeployTargetProvider target); @NotNull TargetSelectionMode getTargetSelectionMode(); @Override void readExternal(Element element); @Override void writeExternal(Element element); public String TARGET_SELECTION_MODE; }
@Test public void getCurrentDeployTargetProviderSelectDeviceSnapshotComboBoxIsVisible() { Object provider = myContext.getCurrentDeployTargetProvider(); assertEquals(myDeviceAndSnapshotComboBoxTargetProvider, provider); }