### Question:
FileAssistant { public static InputStream loadFile(String fileName) { logger.entering(fileName); ClassLoader loader = Thread.currentThread().getContextClassLoader(); InputStream iStream = loader.getResourceAsStream(fileName); if (iStream == null) { try { iStream = new FileInputStream(fileName); } catch (FileNotFoundException e) { } } if (iStream == null) { throw new IllegalArgumentException("[" + fileName + "] is not a valid resource"); } logger.exiting(); return iStream; } private  FileAssistant(); static InputStream loadFile(String fileName); static InputStream loadFile(File file); static String readFile(String fileName); static void writeStreamToFile(InputStream isr, String fileName, String outputFolder);  }### Answer:
@Test(groups = "unit") public void testLoadFileWithFileObject() { InputStream istream = FileAssistant.loadFile(new File("src/test/resources/List.yaml")); assertNotNull(istream, "File Load test via File Object"); }
@Test(groups = "unit") public void testLoadFileWithClassPath() { InputStream istream = FileAssistant.loadFile("List.yaml"); assertNotNull(istream, "File Load test via File Object"); }
@Test(groups = "unit", expectedExceptions = { IllegalArgumentException.class }, expectedExceptionsMessageRegExp = ".* not a valid resource") public void testLoadFileWithFileObjectNegative() { FileAssistant.loadFile(new File("src/test/resources/PayPalProfilePageDoesntExist.yaml")); }
@Test(groups = "unit", expectedExceptions = { IllegalArgumentException.class }, expectedExceptionsMessageRegExp = ".* not a valid resource") public void testLoadFileWithClassPathNegative() { FileAssistant.loadFile("PayPalProfilePageDoesntExist.yaml"); }