### Question:
ResourceTypeUtils { public static Properties getStringProperties(File rrdDirectory, String relativePath) { Assert.notNull(rrdDirectory, "rrdDirectory argument must not be null"); Assert.notNull(relativePath, "relativePath argument must not be null"); File resourceDir = new File(rrdDirectory, relativePath); return getStringProperties(resourceDir); }  static Set<OnmsAttribute> getAttributesAtRelativePath(File rrdDirectory, String relativePath); static Properties getDsProperties(File directory); static File getRrdFileForDs(File directory, String ds); static boolean isStoreByGroup(); static boolean isStoreByForeignSource(); static boolean isResponseTime(String relativePath); static Properties getStringProperties(File rrdDirectory, String relativePath); static Properties getProperties(File file); static ThreadCategory log(); static void saveUpdatedProperties(File propertiesFile, Properties props); static void updateDsProperties(File resourceDir, Map<String, String> dsNamesToRrdNames); static void updateStringProperty(File resourceDir, String attrVal, String attrName); static String getStringProperty(File directory, String key); static File getRelativeNodeSourceDirectory(String nodeSource); static String DS_PROPERTIES_FILE; }### Answer:
@Test public void testLoadPropertiesNullRrdDirectory() { ThrowableAnticipator ta = new ThrowableAnticipator(); ta.anticipate(new IllegalArgumentException("rrdDirectory argument must not be null")); try { ResourceTypeUtils.getStringProperties(null, "something"); } catch (Throwable t) { ta.throwableReceived(t); } ta.verifyAnticipated(); }
@Test public void testLoadPropertiesNullRelativePath() { ThrowableAnticipator ta = new ThrowableAnticipator(); ta.anticipate(new IllegalArgumentException("relativePath argument must not be null")); try { ResourceTypeUtils.getStringProperties(new File(""), null); } catch (Throwable t) { ta.throwableReceived(t); } ta.verifyAnticipated(); }
@Test public void testLoadPropertiesEmpty() throws Exception { OnmsResource childResource = createResource(); createPropertiesFile(childResource, "", false); Properties p = ResourceTypeUtils.getStringProperties(m_fileAnticipator.getTempDir(), "snmp/1/eth0"); assertNotNull("properties should not be null", p); assertEquals("properties size", 0, p.size()); }
@Test public void testLoadPropertiesNonEmpty() throws Exception { OnmsResource childResource = createResource(); createPropertiesFile(childResource, "foo=bar", false); Properties p = ResourceTypeUtils.getStringProperties(m_fileAnticipator.getTempDir(), "snmp/1/eth0"); assertNotNull("properties should not be null", p); assertEquals("properties size", 1, p.size()); assertNotNull("property 'foo' should exist", p.get("foo")); assertEquals("property 'foo' value", "bar", p.get("foo")); }
@Test public void testLoadPropertiesDoesNotExist() throws Exception { OnmsResource childResource = createResource(); createPropertiesFile(childResource, "", true); Properties p = ResourceTypeUtils.getStringProperties(m_fileAnticipator.getTempDir(), "snmp/1/eth0"); assertNull("no properties file was created, so the properties object should be null", p); }