### Question:
WorkerProcessCommandLine implements CommandLine { static File findAgentJarFile(final List<File> systemClasspath) { for (final File pathEntry : systemClasspath) { final File f = pathEntry.getParentFile(); final File parentFile = f != null ? f : new File("."); final File[] children = parentFile.listFiles(); if (children != null) { for (final File candidate : children) { if (isAgentJar(candidate.getName())) { return candidate; } } } } return null; } WorkerProcessCommandLine(final GrinderProperties properties,
                                  final Properties systemProperties,
                                  final String jvmArguments,
                                  final Directory workingDirectory); @Override Directory getWorkingDirectory(); @Override List<String> getCommandList(); @Override String toString();  }### Answer:
@Test public void testFindAgentJarFile() throws Exception { assertNull(WorkerProcessCommandLine.findAgentJarFile(path("foo.jar"))); assertNull(WorkerProcessCommandLine.findAgentJarFile(path("/foo.jar"))); assertNull( WorkerProcessCommandLine.findAgentJarFile(path("/notthere/foo.jar"))); assertNull( WorkerProcessCommandLine.findAgentJarFile( path("somewhere ", "somewhereelse"))); final File directories = new File(getDirectory(), "a/b"); directories.mkdirs(); assertNull( WorkerProcessCommandLine.findAgentJarFile(path(directories.getPath() + "/c.jar"))); final File f = new File(directories, "grinder-dcr-agent-1.20.jar"); f.createNewFile(); assertNotNull( WorkerProcessCommandLine.findAgentJarFile(path(f.getAbsolutePath()))); assertNull( WorkerProcessCommandLine.findAgentJarFile( asList(new File(getDirectory().getAbsoluteFile(), "c.jar")))); }