### Question:
GroupEngineClient { public Group update(long groupId, GroupUpdater groupUpdater) { try { return groupAPI.updateGroup(groupId, groupUpdater); } catch (GroupNotFoundException e) { throw new APIException(new _("Can't update group. Group not found")); } catch (UpdateException e) { throw new APIException(new _("Error when updating group"), e); } catch (AlreadyExistsException e) { throw new APIException(new _("A group with the name %groupName% already exists", new Arg("groupName", groupUpdater.getFields().get(GroupField.NAME)))); } } protected  GroupEngineClient(GroupAPI groupAPI); Group get(Long groupId); String getPath(String groupId); void delete(List<Long> groupIds); Group update(long groupId, GroupUpdater groupUpdater); Group create(GroupCreator groupCreator);  }### Answer:
@Test public void update_update_a_group_in_engine_repository() throws Exception { GroupUpdater groupUpdater = new GroupUpdater(); groupEngineClient.update(1L, groupUpdater); verify(groupAPI).updateGroup(1L, groupUpdater); }
@Test(expected = APIException.class) public void update_throw_APIException_if_group_not_exists_in_engine_repository() throws Exception { when(groupAPI.updateGroup(eq(1L), any(GroupUpdater.class))).thenThrow(new GroupNotFoundException(new Exception())); groupEngineClient.update(1L, new GroupUpdater()); }
@Test(expected = APIException.class) public void update_throw_APIException_if_an_exception_occurs_when_updating_in_engine_repository() throws Exception { when(groupAPI.updateGroup(eq(1L), any(GroupUpdater.class))).thenThrow(new UpdateException("")); groupEngineClient.update(1L, new GroupUpdater()); }
@Test(expected = APIException.class) public void update_throw_APIException_if_an_exception_occurs_when_updating_with_name_alreayExist() throws Exception { when(groupAPI.updateGroup(eq(1L), any(GroupUpdater.class))).thenThrow(new AlreadyExistsException("")); groupEngineClient.update(1L, new GroupUpdater()); }