### Question:
JsonUtil { public static String getNPMArchiveLicenseName(final File file) throws IOException { final JSONObject obj = readJsconFile(file); final JSONArray licensesArray = obj.optJSONArray("licenses"); if (licensesArray != null) { final Iterator<Object> iter = licensesArray.iterator(); while (iter.hasNext()) { Object o = iter.next(); if (o instanceof JSONObject) { final JSONObject jobj = (JSONObject) o; final String typeValue = jobj.optString("type"); if (typeValue != null) { return typeValue; } } } } final JSONObject licenseObject = obj.optJSONObject("license"); if (licenseObject != null) { return licenseObject.optString("type"); } return obj.optString("license"); } private  JsonUtil(); static ArchiveIdentifierVersion getNPMArchiveDescription(final File file); static String getNPMArchiveLicenseName(final File file); static String getNPMArchiveVendorName(final File file); static Author getNPMAuthor(final File file);  }### Answer:
@Test public void getNPMArchiveLicenseNameWithSingleLicenseTest() throws Exception { File packageFile = getFileFromClasspath("package.json"); String actual = JsonUtil.getNPMArchiveLicenseName(packageFile); Assert.assertEquals("ISC", actual); }
@Test public void getNPMArchiveLicenseNameWithNoLicenseTest() throws Exception { File packageFile = getFileFromClasspath("package-no-license.json"); String actual = JsonUtil.getNPMArchiveLicenseName(packageFile); Assert.assertEquals("", actual); }
@Test public void getNPMArchiveLicenseNameWithMultipleLicensesTest() throws Exception { File packageFile = getFileFromClasspath("package-multiple-licenses.json"); String actual = JsonUtil.getNPMArchiveLicenseName(packageFile); Assert.assertEquals("MIT", actual); }