Source:
<code>public void testSSHPostReceiveHook() throws IOException { FileSystemHooks.FileSystemHook hook = spy(new FileSystemHooks.FileSystemHook() { @Override public void execute(FileSystemHookExecutionContext context) { assertEquals("repo", context.getFsName()); } }); Assume.assumeFalse("UF-511", System.getProperty("java.vendor").equals("IBM Corporation")); provider.setAuthenticator((username, password) -> new FileSystemUser() { @Override public String getName() { return "admin"; } }); provider.setAuthorizer((fs, fileSystemUser) -> true); CredentialsProvider.setDefault(new UsernamePasswordCredentialsProvider("admin", "")); assertEquals("10001", provider.getGitSSHService().getProperties().get(SshServer.IDLE_TIMEOUT)); final URI originRepo = URI.create("git://repo"); final JGitFileSystem origin = (JGitFileSystem) provider.newFileSystem(originRepo, new HashMap<String, Object>() {{ put(FileSystemHooks.ExternalUpdate.name(), hook); }}); new Commit(origin.getGit(), "master", "user1", "user1@example.com", "commitx", null, null, false, new HashMap<String, File>() {{ put("file-name.txt", tempFile("temp1")); }}).execute(); JGitFileSystem clone; clone = (JGitFileSystem) provider.newFileSystem(URI.create("git://repo-clone"), new HashMap<String, Object>() {{ put("init", "true"); put("origin", "ssh://admin@localhost:" + gitSSHPort + "/repo"); }}); assertNotNull(clone); provider.getFileSystem(URI.create("git://repo-clone?push=ssh://admin@localhost:" + gitSSHPort + "/repo")); <START> verify(hook).execute(any()); <END> }</code><technical_language>please verify execute() called expected FileSystemHookExecutionContext</technical_language>

Target:
public void testSSHPostReceiveHook() throws IOException { FileSystemHooks.FileSystemHook hook = spy(new FileSystemHooks.FileSystemHook() { @Override public void execute(FileSystemHookExecutionContext context) { assertEquals("repo", context.getFsName()); } }); Assume.assumeFalse("UF-511", System.getProperty("java.vendor").equals("IBM Corporation")); provider.setAuthenticator((username, password) -> new FileSystemUser() { @Override public String getName() { return "admin"; } }); provider.setAuthorizer((fs, fileSystemUser) -> true); CredentialsProvider.setDefault(new UsernamePasswordCredentialsProvider("admin", "")); assertEquals("10001", provider.getGitSSHService().getProperties().get(SshServer.IDLE_TIMEOUT)); final URI originRepo = URI.create("git://repo"); final JGitFileSystem origin = (JGitFileSystem) provider.newFileSystem(originRepo, new HashMap<String, Object>() {{ put(FileSystemHooks.ExternalUpdate.name(), hook); }}); new Commit(origin.getGit(), "master", "user1", "user1@example.com", "commitx", null, null, false, new HashMap<String, File>() {{ put("file-name.txt", tempFile("temp1")); }}).execute(); JGitFileSystem clone; clone = (JGitFileSystem) provider.newFileSystem(URI.create("git://repo-clone"), new HashMap<String, Object>() {{ put("init", "true"); put("origin", "ssh://admin@localhost:" + gitSSHPort + "/repo"); }}); assertNotNull(clone); provider.getFileSystem(URI.create("git://repo-clone?push=ssh://admin@localhost:" + gitSSHPort + "/repo")); ArgumentCaptor<FileSystemHookExecutionContext> captor = ArgumentCaptor.forClass(FileSystemHookExecutionContext.class); verify(hook).execute(captor.capture()); Assertions.assertThat(captor.getValue()) .isNotNull() .hasFieldOrPropertyWithValue("fsName", "repo"); }