### Question:
GitPushEvent extends AbstractHookEvent { @Override public JSONObject perform(final ObjectMapper mapper, final Event serviceHookEvent, final String message, final String detailedMessage) { final Object resource = serviceHookEvent.getResource(); final GitPush gitPush = mapper.convertValue(resource, GitPush.class); final GitCodePushedEventArgs args = decodeGitPush(gitPush, serviceHookEvent); final CommitParameterAction parameterAction = new CommitParameterAction(args); final ArrayList<Action> actions = new ArrayList<Action>(); actions.add(parameterAction); final List<GitStatus.ResponseContributor> contributors = pollOrQueueFromEvent(args, actions, false); final JSONObject response = fromResponseContributors(contributors); return response; }  @Override JSONObject perform(final ObjectMapper mapper, final Event serviceHookEvent, final String message, final String detailedMessage);  }### Answer:
@Test public void perform_noCommitsInPayload() throws Exception { final GitPushEvent gpe = new GitPushEvent(); final ObjectMapper mapper = EndpointHelper.MAPPER; final Event event = new Event(); final ResourceContainer collectionResourceContainer = new ResourceContainer() {{ setId(UUID.fromString("c12d0eb8-e382-443b-9f9c-c52cba5014c2")); }}; final Map<String, ResourceContainer> resourceContainers = new LinkedHashMap<String, ResourceContainer>() {{ put("collection", collectionResourceContainer); }}; event.setResourceContainers(resourceContainers); final TeamProjectReference project = new TeamProjectReference() {{ setName("Fabrikam-Fiber-Git"); }}; final Map<String, Object> repository = new LinkedHashMap<String, Object>() {{ put("url", "https: put("project", project); put("remoteUrl", "https: }}; final IdentityRef pushedBy = new IdentityRef() {{ setDisplayName("Jamal Hartnett"); }}; final ArrayList<GitRefUpdate> refUpdates = new ArrayList<GitRefUpdate>(); final GitRefUpdate gitRefUpdate = new GitRefUpdate(); gitRefUpdate.setName("master"); refUpdates.add(gitRefUpdate); final Map<String, Object> resource = new LinkedHashMap<String, Object>() {{ put("commits", null); put("repository", repository); put("pushedBy", pushedBy); put("refUpdates", refUpdates); }}; event.setResource(resource); final JSONObject actual = gpe.perform(mapper, event, null, null); final JSONArray messages = actual.getJSONArray("messages"); Assert.assertEquals(1, messages.size()); final String message = messages.getString(0).trim(); Assert.assertEquals("No commits were pushed, skipping further event processing.", message); }