@Test public void exceptionIsThrownForWronglyConstructedJsonDictionary_2() { final Map<String, Object> eventMap = ImmutableMap.of("resource_import", new Object()); assertThatExceptionOfType(RuntimeException.class).isThrownBy(() -> ResourceImportEvent.from(eventMap)); }
public static ResourceImportEvent from(final Map<String, Object> eventMap) { final List<?> arguments = (List<?>) eventMap.get("resource_import"); final Map<?, ?> attributes = (Map<?, ?>) arguments.get(1); final URI path = Events.toFileUri((String) attributes.get("source")); final URI importerPath = Events.toFileUri((String) attributes.get("importer")); if (path == null) { throw new IllegalArgumentException("Resource import event has to contain path to imported resource"); } return new ResourceImportEvent(path, importerPath); }
ResourceImportEvent { public static ResourceImportEvent from(final Map<String, Object> eventMap) { final List<?> arguments = (List<?>) eventMap.get("resource_import"); final Map<?, ?> attributes = (Map<?, ?>) arguments.get(1); final URI path = Events.toFileUri((String) attributes.get("source")); final URI importerPath = Events.toFileUri((String) attributes.get("importer")); if (path == null) { throw new IllegalArgumentException("Resource import event has to contain path to imported resource"); } return new ResourceImportEvent(path, importerPath); } }
ResourceImportEvent { public static ResourceImportEvent from(final Map<String, Object> eventMap) { final List<?> arguments = (List<?>) eventMap.get("resource_import"); final Map<?, ?> attributes = (Map<?, ?>) arguments.get(1); final URI path = Events.toFileUri((String) attributes.get("source")); final URI importerPath = Events.toFileUri((String) attributes.get("importer")); if (path == null) { throw new IllegalArgumentException("Resource import event has to contain path to imported resource"); } return new ResourceImportEvent(path, importerPath); } ResourceImportEvent(final URI path, final URI importerPath); }
ResourceImportEvent { public static ResourceImportEvent from(final Map<String, Object> eventMap) { final List<?> arguments = (List<?>) eventMap.get("resource_import"); final Map<?, ?> attributes = (Map<?, ?>) arguments.get(1); final URI path = Events.toFileUri((String) attributes.get("source")); final URI importerPath = Events.toFileUri((String) attributes.get("importer")); if (path == null) { throw new IllegalArgumentException("Resource import event has to contain path to imported resource"); } return new ResourceImportEvent(path, importerPath); } ResourceImportEvent(final URI path, final URI importerPath); static ResourceImportEvent from(final Map<String, Object> eventMap); URI getPath(); boolean isDynamicallyImported(); Optional<URI> getImporterPath(); @Override boolean equals(final Object obj); @Override int hashCode(); }
ResourceImportEvent { public static ResourceImportEvent from(final Map<String, Object> eventMap) { final List<?> arguments = (List<?>) eventMap.get("resource_import"); final Map<?, ?> attributes = (Map<?, ?>) arguments.get(1); final URI path = Events.toFileUri((String) attributes.get("source")); final URI importerPath = Events.toFileUri((String) attributes.get("importer")); if (path == null) { throw new IllegalArgumentException("Resource import event has to contain path to imported resource"); } return new ResourceImportEvent(path, importerPath); } ResourceImportEvent(final URI path, final URI importerPath); static ResourceImportEvent from(final Map<String, Object> eventMap); URI getPath(); boolean isDynamicallyImported(); Optional<URI> getImporterPath(); @Override boolean equals(final Object obj); @Override int hashCode();  }