### Question:
StagingDeleteMojo extends StagingActionMojo { @Override public void execute() throws MojoExecutionException, MojoFailureException { failIfOffline(); tag = getTag(); RepositoryManagerV3Client client = getRepositoryManagerV3Client(); try { List<ComponentInfo> deletedComponents = client.delete(tag); getLog().info(String.format("'%d' components deleted with tag '%s' ", deletedComponents.size(), tag)); if (getLog().isDebugEnabled()) { getLog().debug(String.format("Deleted components: %s with tag: %s", deletedComponents, tag)); } } catch (Exception ex) { throw new MojoFailureException(ex.getMessage(), ex); } }  @Override void execute();  }### Answer:
@Test(expected = IllegalArgumentException.class) public void throwIllegalArgumentExceptionWhenIncorrectServerId() throws Exception { createPropertiesFile(TAG, true); when(settings.getServer(anyString())).thenReturn(null); underTest.execute(); }
@Test(expected = MojoFailureException.class) public void executeFailsWhenOffline() throws Exception { underTest.setOffline(true); underTest.execute(); }
@Test(expected = IllegalArgumentException.class) public void executeFailsWhenSecDispatcherThrowsException() throws Exception { when(secDispatcher.decrypt(anyString())).thenThrow(new SecDispatcherException()); underTest.setSecDispatcher(secDispatcher); underTest.execute(); }
@Test public void testDefaultValueWhenTagIsNull() throws Exception { createPropertiesFile(TAG, true); underTest.setTag(null); underTest.execute(); verify(client).delete(eq(TAG)); }
@Test public void testDefaultValueWhenTagIsEmpty() throws Exception { createPropertiesFile(TAG, true); underTest.setTag(""); underTest.execute(); verify(client).delete(eq(TAG)); }
@Test public void testDelete() throws Exception { underTest.execute(); verify(client).delete(eq(TAG)); }
@Test(expected = MojoFailureException.class) public void mojoFailureExceptionOnDeleteFail() throws Exception { doThrow(new RuntimeException()).when(client).delete(anyString()); underTest.execute(); }
@Test(expected = MojoExecutionException.class) public void mojoFailureExceptionOnPropertiesFileNotFound() throws Exception { underTest.setTag(null); underTest.execute(); }
@Test(expected = MojoExecutionException.class) public void mojoFailureExceptionOnTagNotPresentInPropertiesFile() throws Exception { createPropertiesFile("", true); underTest.setTag(""); underTest.execute(); }
@Test(expected = MojoExecutionException.class) public void mojoFailureExceptionOnTagPropertyNotDefinedInPropertiesFile() throws Exception { createPropertiesFile(TAG, false); underTest.setTag(""); underTest.execute(); }