### Question:
GoogleAppsChangeLogConsumer extends ChangeLogConsumerBase { protected void processGroupDelete(GoogleAppsChangeLogConsumer consumer, ChangeLogEntry changeLogEntry) { LOG.debug("Google Apps Consumer '{}' - Change log entry '{}' Processing group delete.", consumerName, toString(changeLogEntry)); final String groupName = changeLogEntry.retrieveValueForLabel(ChangeLogLabels.GROUP_DELETE.name); final edu.internet2.middleware.grouper.Group grouperGroup = connector.fetchGrouperGroup(groupName); LOG.debug("Google Apps Consumer '{}' - Change log entry '{}' The group object is null: {} (if true, then the PIT info will be used.)", new Object[]{consumerName, toString(changeLogEntry), grouperGroup == null}); if (grouperGroup != null) { if (!connector.shouldSyncStem(grouperGroup.getParentStem())) { LOG.debug("Google Apps Consumer '{}' - Change log entry '{}' Skipping group delete, nothing to do cause the group is not flagged or is gone.", consumerName, toString(changeLogEntry)); return; } try { LOG.debug("Google Apps Consumer '{}' - Change log entry '{}' Trying to delete via Grouper Group data", consumerName, toString(changeLogEntry)); connector.deleteGooGroup(grouperGroup); return; } catch (IOException e) { LOG.error("Google Apps Consumer '{}' - Change log entry '{}' Error processing group delete: {}", new Object[]{consumerName, toString(changeLogEntry), e.getMessage()}); } } else { PITGroup group = PITGroupFinder.findByName(groupName, false, true).iterator().next(); if (!connector.shouldSyncStem(group.getPITStem().getName())) { LOG.debug("Google Apps Consumer '{}' - Change log entry '{}' Skipping PIT-based group delete, nothing to do cause the group is not flagged or is gone.", consumerName, toString(changeLogEntry)); return; } try { LOG.debug("Google Apps Consumer '{}' - Change log entry '{}' Trying to delete via Grouper PITGroup data", consumerName, toString(changeLogEntry)); connector.deleteGooGroup(group); return; } catch (IOException e) { LOG.error("Google Apps Consumer '{}' - Change log entry '{}' Error processing group delete: {}", new Object[]{consumerName, toString(changeLogEntry), e.getMessage()}); } } } GoogleAppsChangeLogConsumer(); @Override long processChangeLogEntries(final List<ChangeLogEntry> changeLogEntryList,
                                        ChangeLogProcessorMetadata changeLogProcessorMetadata);  }### Answer:
@Test public void testProcessGroupDelete() throws GeneralSecurityException, IOException { createTestGroup(groupDisplayName, groupName); ChangeLogEntry deleteEntry = mock(ChangeLogEntry.class); when(deleteEntry.getChangeLogType()).thenReturn(new ChangeLogType("group", "deleteGroup", "")); when(deleteEntry.retrieveValueForLabel(ChangeLogLabels.GROUP_DELETE.name)).thenReturn(groupName); when(deleteEntry.getContextId()).thenReturn("123456789"); ArrayList<ChangeLogEntry> changeLogEntryList = new ArrayList<ChangeLogEntry>(Arrays.asList(deleteEntry)); consumer.processChangeLogEntries(changeLogEntryList, metadata); assertTrue(GoogleAppsSdkUtils.retrieveGroup(directory, addressFormatter.qualifyGroupAddress(groupName)) == null); }