### Question:
SingleSelectionPane extends VBox implements ModuleOwned, PdfDocumentDescriptorProvider, RestorableView { @Override public void restoreStateFrom(Map<String, String> data) { getField().getTextField().setText(EMPTY); Optional.ofNullable(data.get(defaultString(getId()) + "input")).ifPresent(f -> { onValidState.disabled(true); getField().getTextField().setText(f); onValidState.disabled(false); initializeFor(newDescriptor(new File(f), ofNullable(data.get(defaultString(getId()) + "input.password.enc")).map(EncryptionUtils::decrypt) .orElseGet(() -> data.get(defaultString(getId()) + "input.password")))); }); } SingleSelectionPane(String ownerModule); @Override PdfDocumentDescriptor getPdfDocumentDescriptor(); @Override void saveStateTo(Map<String, String> data); @Override void restoreStateFrom(Map<String, String> data); void addOnLoaded(Consumer<PdfDocumentDescriptor> onDescriptorLoaded); @EventListener void onClearSelected(ClearModuleEvent event); @EventListener void onLoadDocumentsRequest(PdfLoadRequestEvent loadEvent); @Override @EventStation String getOwnerModule(); void setPromptText(String text);  }### Answer:
@Test public void restoreStateFrom() { Listener<PdfLoadRequestEvent> listener = mock(Listener.class); eventStudio().add(PdfLoadRequestEvent.class, listener); Map<String, String> data = new HashMap<>(); data.put("victim-selection-paneinput", "chuck.pdf"); data.put("victim-selection-paneinput.password.enc", EncryptionUtils.encrypt("pwd")); WaitForAsyncUtils.waitForAsyncFx(2000, () -> victim.restoreStateFrom(data)); assertEquals("chuck.pdf", victim.getField().getTextField().getText()); assertEquals("pwd", victim.getPdfDocumentDescriptor().getPassword()); verify(listener).onEvent(any()); }