### Question:
SelfExtractingExecutableMojo extends AbstractMojo implements SelfExtractingExecutableConfiguration { void verifyOutputDirectory() throws MojoFailureException { getLog().info(format("verifying workspace directory %s:", workspace)); if (workspace == null) { throw new MojoFailureException( "Error: Workspace directory <null> does not exist. Should not be here"); } if (!workspace.exists()) { getLog() .info( format( "Directory '%s' does not exist. Attempting to create '%s' and its parents...", workspace, workspace)); if (!workspace.mkdirs()) { getLog().warn(format("Failed to create directory '%s' or one of its parents", workspace)); } else { getLog().info(format("Successfully created directory '%s'", workspace)); } } if (!workspace.isDirectory()) { getLog() .warn( format( "Error: directory '%s' exists but is not a directory. Not overwriting", workspace)); throw new MojoFailureException( format("Error. File '%s' exists but is not a directory", workspace)); } if (!workspace.canWrite()) { getLog() .warn( format( "Error: directory '%s' exists and is a directory, yet I cannot write to it", workspace)); throw new MojoFailureException( format( "Error: cannot write to directory '%s'. Check its permissions and try again (or delete it and let me create it)", workspace)); } }  @Override ExecutableFileConfiguration getExecutableFileConfiguration(); @Override void execute();  }### Answer:
@Test public void ensureWorkspaceDirectoryIsSet() throws Exception { mojo = getSelfExtractingExecutableMojo(); assertNotNull(mojo); assertNotNull(mojo.getWorkspace()); mojo.verifyOutputDirectory(); assertTrue(mojo.getWorkspace().exists()); }