### Question:
TomcatEngineController implements EngineController { public int start(List<String> javaOpts) { List<String> catalinaOpts = new ArrayList<String>(javaOpts); String configFileUrl; try { configFileUrl = new File(catalinaBase + "/conf/hq-catalina.properties").toURI().toURL().toString(); } catch (MalformedURLException e) { log.error("Unable to determine URL for config file " + catalinaBase + "/conf/hq-catalina.properties. Cause: " + e.getMessage()); return 1; } catalinaOpts.add("-Dcatalina.config=" + configFileUrl); catalinaOpts.add("-Dcom.sun.management.jmxremote"); catalinaOpts.add("-Djava.endorsed.dirs" + catalinaHome + "/endorsed"); catalinaOpts.add("-Dcatalina.base=" + catalinaBase); catalinaOpts.add("-Dcatalina.home=" + catalinaHome); catalinaOpts.add("-Djava.io.tmpdir=" + catalinaBase + "/temp"); catalinaOpts.add("-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager"); String[] commandLine = new String[catalinaOpts.size() + 5]; String classpath = catalinaHome + "/bin/tomcat-juli.jar" + File.pathSeparator + catalinaHome + "/bin/bootstrap.jar" ; String javaHome = System.getProperty("java.home"); commandLine[0] = javaHome + "/bin/java"; commandLine[1] = "-cp"; commandLine[2] = classpath; int index = 3; for (String catalinaOpt : catalinaOpts) { commandLine[index] = catalinaOpt; index++; } commandLine[index] = "org.apache.catalina.startup.Bootstrap"; commandLine[index + 1] = "start"; return processManager.executeProcess(commandLine, serverHome, false, -1); } @Autowired  TomcatEngineController(ProcessManager processManager,
                                  @Value("#{ systemProperties['engine.home'] }") String engineHome,
                                  @Value("#{ systemProperties['server.home'] }") String serverHome); int start(List<String> javaOpts); boolean stop(); void halt(); boolean isEngineRunning();  }### Answer:
@Test public void testStart() throws MalformedURLException { final List<String> expectedOpts = new ArrayList<String>(); expectedOpts.add("-XX:MaxPermSize=192m"); expectedOpts.add("-Xmx512m"); expectedOpts.add("-Xms512m"); expectedOpts.add("-XX:+HeapDumpOnOutOfMemoryError"); expectedOpts.add("-Dserver.home=" + serverHome); EasyMock .expect( processManager .executeProcess( EasyMock .aryEq(new String[] { System.getProperty("java.home") + "/bin/java", "-cp", catalinaHome + "/bin/tomcat-juli.jar" + File.pathSeparator + catalinaHome + "/bin/bootstrap.jar", "-XX:MaxPermSize=192m", "-Xmx512m", "-Xms512m", "-XX:+HeapDumpOnOutOfMemoryError", "-Dserver.home=" + serverHome, "-Dcatalina.config=" + new File(catalinaBase + "/conf/hq-catalina.properties").toURI().toURL().toString(), "-Dcom.sun.management.jmxremote", "-Djava.endorsed.dirs" + catalinaHome + "/endorsed", "-Dcatalina.base=" + catalinaBase, "-Dcatalina.home=" + catalinaHome, "-Djava.io.tmpdir=" + catalinaBase + "/temp", "-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager", "org.apache.catalina.startup.Bootstrap", "start" }), EasyMock.eq(serverHome), EasyMock .eq(false), EasyMock.eq(-1))).andReturn(0); replay(); int exitCode = tomcatEngineController.start(expectedOpts); verify(); assertEquals(0, exitCode); }