### Question:
ConfigHelper { public static String[] getConfigArgs(final ServiceElement service) throws IOException { return getConfigArgs(service, Thread.currentThread().getContextClassLoader()); }  static String[] getConfigArgs(final ServiceElement service); static String[] getConfigArgs(final ServiceElement service, final ClassLoader cl); static final String CLASSPATH_RESOURCE; static final String FILE_RESOURCE; }### Answer:
@Test(expected = IllegalArgumentException.class) public void testGetConfigArgsNoCLassLoader() throws IOException { ConfigHelper.getConfigArgs(new ServiceElement(), null); }
@Test public void testUsingConfig() throws IOException { ServiceElement service = new ServiceElement(); service.getServiceBeanConfig().setConfigArgs(getConfig()); String[] args = ConfigHelper.getConfigArgs(service); Assert.assertNotNull(args); Assert.assertEquals(1, args.length); File file = new File(args[0]); Assert.assertTrue(file.exists()); Configuration configuration = new GroovyConfig(args, Thread.currentThread().getContextClassLoader()); Assert.assertNotNull(configuration); }
@Test public void testUsingGroovyConfig() throws IOException { ServiceElement service = new ServiceElement(); service.getServiceBeanConfig().setConfigArgs(getGroovyConfig()); String[] args = ConfigHelper.getConfigArgs(service); Assert.assertNotNull(args); Assert.assertEquals(1, args.length); File file = new File(args[0]); Assert.assertFalse(file.exists()); Configuration configuration = new GroovyConfig(args, Thread.currentThread().getContextClassLoader()); Assert.assertNotNull(configuration); }
@Test(expected = FileNotFoundException.class) public void testUsingMissingGroovyFile() throws IOException { ServiceElement service = new ServiceElement(); service.getServiceBeanConfig().setConfigArgs("file:foo"); String[] args = ConfigHelper.getConfigArgs(service); Assert.assertNotNull(args); Configuration configuration = new GroovyConfig(args, Thread.currentThread().getContextClassLoader()); Assert.assertNotNull(configuration); }