Source:
public void testGitHubAppEndpoints() throws Exception { CommonTestUtilities.cleanStatePrivate2(SUPPORT, false); final ApiClient webClient = getWebClient("admin@admin.com", testingPostgres); WorkflowsApi client = new WorkflowsApi(webClient); String serviceRepo = "DockstoreTestUser2/test-service"; String installationId = "1179416"; List<io.swagger.client.model.Workflow> services = client.handleGitHubRelease(serviceRepo, "DockstoreTestUser2", "refs/tags/1.0", installationId); assertEquals("Should have added one service", 1, services.size()); io.swagger.client.model.Workflow service = services.get(0); assertNotNull(service); assertEquals("Should have a new version", 1, service.getWorkflowVersions().size()); assertEquals("Should have 3 source files", 3, service.getWorkflowVersions().get(0).getSourceFiles().size()); assertEquals("Should have 1 user", 1, service.getUsers().size()); final long count = testingPostgres.runSelectStatement( "select count(*) from service where sourcecontrol = 'github.com' and organization = 'DockstoreTestUser2' and repository = 'test-service'", long.class); Assert.assertEquals("there should be one matching service", 1, count); UsersApi usersApi = new UsersApi(webClient); services = usersApi.userServices(service.getUsers().get(0).getId()); List<io.swagger.client.model.Workflow> workflows = new ArrayList<>(); try { workflows.addAll(usersApi.userWorkflows(service.getUsers().get(0).getId())); Assert.fail("Bioworkflows should not be returned through Services endpoint."); } catch (ApiException ex) { assertEquals("Should fail to cast BioWorkflows with 500 error", HttpStatus.SC_INTERNAL_SERVER_ERROR, ex.getCode()); } assertEquals("There should be one service", 1, services.size()); assertEquals("There should be no workflows", 0, workflows.size()); }

Target:
public void testGitHubAppEndpoints() throws Exception { CommonTestUtilities.cleanStatePrivate2(SUPPORT, false); final ApiClient webClient = getWebClient("admin@admin.com", testingPostgres); WorkflowsApi client = new WorkflowsApi(webClient); String serviceRepo = "DockstoreTestUser2/test-service"; String installationId = "1179416"; List<io.swagger.client.model.Workflow> services = client.handleGitHubRelease(serviceRepo, "DockstoreTestUser2", "refs/tags/1.0", installationId); assertEquals("Should have added one service", 1, services.size()); io.swagger.client.model.Workflow service = services.get(0); assertNotNull(service); assertEquals("Should have a new version", 1, service.getWorkflowVersions().size()); assertEquals("Should have 3 source files", 3, service.getWorkflowVersions().get(0).getSourceFiles().size()); assertEquals("Should have 1 user", 1, service.getUsers().size()); final long count = testingPostgres.runSelectStatement( "select count(*) from service where sourcecontrol = 'github.com' and organization = 'DockstoreTestUser2' and repository = 'test-service'", long.class); Assert.assertEquals("there should be one matching service", 1, count); UsersApi usersApi = new UsersApi(webClient); final long userId = service.getUsers().get(0).getId(); services = usersApi.userServices(userId); List<io.swagger.client.model.Workflow> workflows = usersApi.userWorkflows(userId); assertEquals("There should be one service", 1, services.size()); assertEquals("There should be no workflows", 0, workflows.size()); }