ClientDelegator extends BaseDelegator implements IClientDelegator { @Override public String deleteClient(final String clientName, final boolean force) throws ConnectionException, RequestException, AccessException { try { return deleteClient(clientName, new DeleteClientOptions(force)); } catch (final ConnectionException | AccessException | RequestException exc) { throw exc; } catch (P4JavaException exc) { throw new RequestException(exc.getMessage(), exc); } } ClientDelegator(IOptionsServer server); @Override IClient getClient(final String clientName); @Override IClient getClient(@Nonnull IClientSummary clientSummary); @Override IClient getClientTemplate(String clientName); @Override IClient getClientTemplate(final String clientName, final boolean allowExistent); @Override IClient getClientTemplate(
            @Nonnull String clientName,
            GetClientTemplateOptions getClientTemplateOptions); @Override String createClient(@Nonnull final IClient newClient); @Override String updateClient(@Nonnull final IClient client); @Override String updateClient(@Nonnull final IClient client, final boolean force); @Override String updateClient(@Nonnull final IClient client, final UpdateClientOptions opts); @Override String deleteClient(final String clientName, final boolean force); @Override String deleteClient(final String clientName, final DeleteClientOptions opts); String switchClientView(final String templateClientName,
                                   final String targetClientName,
                                   final SwitchClientViewOptions opts); @Override String switchStreamView(final String streamPath,
                                   final String targetClientName,
                                   final SwitchClientViewOptions opts);  }
@Test public void deleteClient_byClientNameAndForce_shouldReturnDeletedClientName() throws Exception { doReturn(clientName).when(clientDelegator) .deleteClient(any(String.class), any(DeleteClientOptions.class)); String actualClientName = clientDelegator.deleteClient(clientName, false); assertThat(actualClientName, is(clientName)); }
@Test public void deleteClient_byClientNameAndDeleteClientOptions_shouldThrownIllegalArgumentExceptionWhenClientNameIsBlank() throws Exception { expectThrows(IllegalArgumentException.class, () -> clientDelegator.deleteClient(EMPTY, mock(DeleteClientOptions.class))); }
@Test public void deleteClient_byClientNameAndDeleteClientOptions_shouldReturnNonNullDeletedClientName() throws Exception { when(server.execMapCmdList( eq(CLIENT.toString()), any(String[].class), any())) .thenReturn(resultMaps); givenInfoMessageResultMap(); String actualClientName = clientDelegator.deleteClient( clientName, mock(DeleteClientOptions.class)); assertThat(actualClientName, is(clientName)); }