### Question:
ProcessClassesMojo extends AbstractMojo { String getJavaCommand() { String javaCommand = getJavaCommand(new File(System.getProperty("java.home"))); Toolchain tc = toolchainManager.getToolchainFromBuildContext("jdk", session); if (tc != null) { getLog().info("Toolchain in retrolambda-maven-plugin: " + tc); javaCommand = tc.findTool("java"); } if (java8home != null) { if (tc != null) { getLog().warn("Toolchains are ignored, 'java8home' parameter is set to " + java8home); } javaCommand = getJavaCommand(java8home); } return javaCommand; }  @Override void execute(); @Parameter(property = "java8home", required = false)
    public File java8home; @Parameter(defaultValue = "1.7", property = "retrolambdaTarget", required = true)
    public String target; @Parameter(defaultValue = "false", property = "retrolambdaDefaultMethods", required = true)
    public boolean defaultMethods; @Parameter(defaultValue = "false", property = "retrolambdaJavacHacks", required = true)
    public boolean javacHacks; @Parameter(defaultValue = "false", property = "retrolambdaQuiet", required = true)
    public boolean quiet; @Parameter(defaultValue = "false")
    public boolean fork; }### Answer:
@Test public void java_command_defaults_to_current_jvm() { assertThat(mojo.getJavaCommand(), is(new File(System.getProperty("java.home"), "bin/java").getAbsolutePath())); }
@Test public void java_command_from_toolchain_overrides_the_current_jvm() { toolchainManager.setJdkToolChain(new FakeJavaToolChain("jdk-from-toolchain")); assertThat(mojo.getJavaCommand(), is("jdk-from-toolchain/bin/java")); verify(log).info("Toolchain in retrolambda-maven-plugin: JDK[jdk-from-toolchain]"); }
@Test public void java_command_from_local_configuration_overrides_the_toolchain() { toolchainManager.setJdkToolChain(new FakeJavaToolChain("jdk-from-toolchain")); mojo.java8home = new File("jdk-from-local-configuration"); assertThat(mojo.getJavaCommand().replace('\\', '/'), is("jdk-from-local-configuration/bin/java")); verify(log).warn("Toolchains are ignored, 'java8home' parameter is set to jdk-from-local-configuration"); }