### Question:
AddUsersStep implements WikiCreationStep { @Override public void execute(WikiCreationRequest request) throws WikiCreationException { try { String wikId = request.getWikiId(); if (request.getMembers() != null) { wikiUserManager.addMembers(request.getMembers(), wikId); } } catch (WikiUserManagerException e) { throw new WikiCreationException( String.format("Failed to add members to the wiki [%s].", request.getWikiId()), e); } }  @Override void execute(WikiCreationRequest request); @Override int getOrder();  }### Answer:
@Test public void execute() throws Exception { WikiCreationRequest request = new WikiCreationRequest(); request.setWikiId("wikiId"); List<String> members = new ArrayList<>(); request.setMembers(members); mocker.getComponentUnderTest().execute(request); verify(wikiUserManager).addMembers(members, "wikiId"); }
@Test public void executeWhenException() throws Exception { WikiCreationRequest request = new WikiCreationRequest(); request.setWikiId("wikiId"); List<String> members = new ArrayList<>(); request.setMembers(members); Exception exception = new WikiUserManagerException("Execption in WikiUserManager."); doThrow(exception).when(wikiUserManager).addMembers(anyCollection(), any()); WikiCreationException caughtException = null; try { mocker.getComponentUnderTest().execute(request); } catch (WikiCreationException e) { caughtException = e; } assertNotNull(caughtException); assertEquals("Failed to add members to the wiki [wikiId].", caughtException.getMessage()); assertEquals(exception, caughtException.getCause()); }