### Question:
PathScriptArchive implements ScriptArchive { @Override public ScriptModuleSpec getModuleSpec() { return moduleSpec; } protected  PathScriptArchive(ScriptModuleSpec moduleSpec, Path rootDirPath, Set<String> entries, long createTime); @Override ScriptModuleSpec getModuleSpec(); @Override void setModuleSpec(ScriptModuleSpec spec); @Override URL getRootUrl(); @Override Set<String> getArchiveEntryNames(); @Override @Nullable URL getEntry(String entryName); @Override long getCreateTime(); @Override boolean equals(Object o); @Override int hashCode();  }### Answer:
@Test public void testDefaultModuleId() throws Exception { URL rootPathUrl = getClass().getClassLoader().getResource(TEST_TEXT_PATH.getResourcePath()); Path rootPath = Paths.get(rootPathUrl.toURI()).toAbsolutePath(); PathScriptArchive scriptArchive = new PathScriptArchive.Builder(rootPath).build(); assertEquals(scriptArchive.getModuleSpec().getModuleId(), TEST_TEXT_PATH.getModuleId()); }
@Test public void testLoadWithModuleSpec() throws Exception { URL rootPathUrl = getClass().getClassLoader().getResource(TEST_MODULE_SPEC_PATH.getResourcePath()); Path rootPath = Paths.get(rootPathUrl.toURI()).toAbsolutePath(); PathScriptArchive scriptArchive = new PathScriptArchive.Builder(rootPath).build(); ScriptModuleSpec moduleSpec = scriptArchive.getModuleSpec(); assertEquals(moduleSpec.getModuleId(), TEST_MODULE_SPEC_PATH.getModuleId()); assertEquals(moduleSpec.getModuleDependencies(), Collections.emptySet()); Map<String, Object> expectedMetadata = new HashMap<String, Object>(); Map<String, String> expectedMetadata1 = new HashMap<String, String>(); expectedMetadata1.put("nestedKey1", "metadataValue1"); expectedMetadata1.put("nestedKey2", "metadataValue2"); expectedMetadata.put("metadataName1", expectedMetadata1); expectedMetadata.put("metadataName2", 2.0); expectedMetadata.put("metadataName3", Arrays.asList(1.0, 2.0, 3.0)); Map<String, Object> somedata = moduleSpec.getMetadata(); assertEquals(somedata, expectedMetadata); }