private FileSystemHooks.FileSystemHook postCommitCallback() { return ctx -> postCommitNotificationService.notifyUser(repo, (Integer) ctx.getParamValue(FileSystemHooksConstants.POST_COMMIT_EXIT_CODE)); }
private void verifyFSHook(FileSystemHooks.FileSystemHook hook, FileSystemHooks hookType) { verify(hook).execute(contextArgumentCaptor.capture()); FileSystemHookExecutionContext ctx = contextArgumentCaptor.getValue(); Assertions.assertThat(ctx) .isNotNull() .hasFieldOrPropertyWithValue("fsName", FS_NAME); if (hookType.equals(FileSystemHooks.PostCommit)) { Assertions.assertThat(ctx.getParamValue(FileSystemHooksConstants.POST_COMMIT_EXIT_CODE)) .isNotNull() .isEqualTo(EXIT_CODE); } } }
private void testPostCommit(final Integer exitCode) throws IOException { prepareHook(exitCode); commitFile(); verify(postCommitHook).execute(contextCaptor.capture()); FileSystemHookExecutionContext context = contextCaptor.getValue(); Assertions.assertThat(context) .isNotNull() .hasFieldOrPropertyWithValue("fsName", REPO_NAME); Assertions.assertThat(context.getParamValue(FileSystemHooksConstants.POST_COMMIT_EXIT_CODE)) .isNotNull() .isEqualTo(exitCode); }
private void verifyFSHook(FileSystemHooks.FileSystemHook hook, FileSystemHooks hookType) { verify(hook).execute(contextArgumentCaptor.capture()); FileSystemHookExecutionContext ctx = contextArgumentCaptor.getValue(); Assertions.assertThat(ctx) .isNotNull() .hasFieldOrPropertyWithValue("fsName", FS_NAME); if (hookType.equals(FileSystemHooks.PostCommit)) { Assertions.assertThat(ctx.getParamValue(FileSystemHooksConstants.POST_COMMIT_EXIT_CODE)) .isNotNull() .isEqualTo(EXIT_CODE); } } }
private void testPostCommit(final Integer exitCode) throws IOException { prepareHook(exitCode); commitFile(); verify(postCommitHook).execute(contextCaptor.capture()); FileSystemHookExecutionContext context = contextCaptor.getValue(); Assertions.assertThat(context) .isNotNull() .hasFieldOrPropertyWithValue("fsName", REPO_NAME); Assertions.assertThat(context.getParamValue(FileSystemHooksConstants.POST_COMMIT_EXIT_CODE)) .isNotNull() .isEqualTo(exitCode); }