### Question:
GoogleAppsChangeLogConsumer extends ChangeLogConsumerBase { protected void processGroupUpdate(GoogleAppsChangeLogConsumer consumer, ChangeLogEntry changeLogEntry) { LOG.debug("Google Apps Consumer '{}' - Change log entry '{}' Processing group update.", consumerName, toString(changeLogEntry)); final String groupName = changeLogEntry.retrieveValueForLabel(ChangeLogLabels.GROUP_UPDATE.name); final String propertyChanged = changeLogEntry.retrieveValueForLabel(ChangeLogLabels.GROUP_UPDATE.propertyChanged); final String propertyOldValue = changeLogEntry.retrieveValueForLabel(ChangeLogLabels.GROUP_UPDATE.propertyOldValue); final String propertyNewValue = changeLogEntry.retrieveValueForLabel(ChangeLogLabels.GROUP_UPDATE.propertyNewValue); Group group; edu.internet2.middleware.grouper.Group grouperGroup; try { grouperGroup = connector.fetchGrouperGroup(groupName); if (!connector.shouldSyncGroup(grouperGroup)) { LOG.debug("Google Apps Consumer '{}' - Change log entry '{}' Skipping group update, nothing to do cause the group is not flagged or is gone.", consumerName, toString(changeLogEntry)); return; } if (propertyChanged.equalsIgnoreCase("name")) { String oldAddress = connector.getAddressFormatter().qualifyGroupAddress(propertyOldValue); String newAddress = connector.getAddressFormatter().qualifyGroupAddress(propertyNewValue); group = connector.fetchGooGroup(oldAddress); if (group != null) { group.setEmail(newAddress); if (group.getAliases() == null) { group.setAliases(new ArrayList<String>(1)); } group.getAliases().add(oldAddress); connector.getSyncedGroupsAndStems().remove(groupName); GoogleCacheManager.googleGroups().remove(oldAddress); GoogleCacheManager.googleGroups().put(connector.updateGooGroup(oldAddress, group)); } return; } group = connector.fetchGooGroup(connector.getAddressFormatter().qualifyGroupAddress(groupName)); if (propertyChanged.equalsIgnoreCase("displayExtension")) { group.setName(propertyNewValue); } else if (propertyChanged.equalsIgnoreCase("description")) { group.setDescription(propertyNewValue); } else { LOG.warn("Google Apps Consumer '{}' - Change log entry '{}' Unmapped group property updated {}.", new Object[] {consumerName, toString(changeLogEntry), propertyChanged}); } GoogleCacheManager.googleGroups().put(connector.updateGooGroup(connector.getAddressFormatter().qualifyGroupAddress(groupName), group)); } catch (IOException e) { LOG.debug("Google Apps Consumer '{}' - Change log entry '{}' Error processing group update.", consumerName, toString(changeLogEntry)); } } GoogleAppsChangeLogConsumer(); @Override long processChangeLogEntries(final List<ChangeLogEntry> changeLogEntryList,
                                        ChangeLogProcessorMetadata changeLogProcessorMetadata);  }### Answer:
@Test public void testProcessGroupUpdate() throws GeneralSecurityException, IOException { final String NEW_TEST = "newTest"; createTestGroup(groupDisplayName, groupName); ChangeLogEntry addEntry = mock(ChangeLogEntry.class); when(addEntry.getChangeLogType()).thenReturn(new ChangeLogType("group", "updateGroup", "")); when(addEntry.retrieveValueForLabel(ChangeLogLabels.GROUP_UPDATE.name)).thenReturn(groupName); when(addEntry.retrieveValueForLabel(ChangeLogLabels.GROUP_UPDATE.propertyChanged)).thenReturn("displayExtension"); when(addEntry.retrieveValueForLabel(ChangeLogLabels.GROUP_UPDATE.propertyOldValue)).thenReturn(groupDisplayName); when(addEntry.retrieveValueForLabel(ChangeLogLabels.GROUP_UPDATE.propertyNewValue)).thenReturn(NEW_TEST); when(addEntry.getContextId()).thenReturn("123456789"); ArrayList<ChangeLogEntry> changeLogEntryList = new ArrayList<ChangeLogEntry>(Arrays.asList(addEntry)); consumer.processChangeLogEntries(changeLogEntryList, metadata); pause(1000L); Group group = GoogleAppsSdkUtils.retrieveGroup(directory, addressFormatter.qualifyGroupAddress(groupName)); assertNotNull(group); assertEquals(NEW_TEST, group.getName()); }