@Test public void awaitTermination() throws InterruptedException { boolean result = executor.awaitTermination(1, TimeUnit.SECONDS); verify(delegate).awaitTermination(1, TimeUnit.SECONDS); assertThat(result).isEqualTo(delegate.awaitTermination(1, TimeUnit.SECONDS)) .isNotNull(); }
@Test public void isShutdown() { boolean result = executor.isShutdown(); verify(delegate).isShutdown(); assertThat(result).isEqualTo(delegate.isShutdown()).isNotNull(); }
@Test public void isTerminated() { boolean result = executor.isTerminated(); verify(delegate).isTerminated(); assertThat(result).isEqualTo(delegate.isTerminated()).isNotNull(); }
@Test public void decodeWhenSignedThenOk() { NimbusJwtDecoder jwtDecoder = new NimbusJwtDecoder(withSigning(JWK_SET)); Jwt jwt = jwtDecoder.decode(SIGNED_JWT); assertThat(jwt.containsClaim(JwtClaimNames.EXP)).isNotNull(); }
/** * Assert that this is the latest branch * * @return fluent API */ public BranchResponseAssert isLatest() { assertThat(actual.getLatest()).as(descriptionText() + " latest").isNotNull().isTrue(); return this; }
/** * Assert that this is not the latest branch * * @return fluent API */ public BranchResponseAssert isNotLatest() { assertThat(actual.getLatest()).as(descriptionText() + " latest").isNotNull().isFalse(); return this; }
@CsvMethod public void assertTrue(String... identifier) { assertThat(object(identifier).ofType(Boolean.class)).as(prefix() + "Boolean").isNotNull().isTrue(); }
@CsvMethod public void assertFalse(String... identifier) { assertThat(object(identifier).ofType(Boolean.class)).as(prefix() + "Boolean").isNotNull().isFalse(); }
@Test public void shouldBeAbleToConfigureJmxPerformanceCounters() throws Exception{ EnvironmentTestUtils.addEnvironment(context, "azure.application-insights.instrumentation-key: 00000000-0000-0000-0000-000000000000", "azure.application-insights.jmx.jmx-counters:" + "java.lang:type=ClassLoading/LoadedClassCount/Current Loaded Class Count"); context.register(PropertyPlaceholderAutoConfiguration.class, ApplicationInsightsTelemetryAutoConfiguration.class); context.refresh(); PerformanceCounterContainer counterContainer = PerformanceCounterContainer.INSTANCE; Field field = counterContainer.getClass().getDeclaredField("performanceCounters"); field.setAccessible(true); Map<String, PerformanceCounter> map = (Map<String, PerformanceCounter>)field.get(counterContainer); assertThat(map.containsKey("java.lang:type=ClassLoading")).isNotNull(); }
@Test public void getValue() throws Exception { // exercise final Boolean actual = underTest.getValue(); // verify assertThat(actual) .isNotNull() .isTrue(); } }
@Test (dependsOnMethods = "testAssignDefaultParticipantsOnError") public void testAssignParticipants() { final User testUser = getTestUser(); final RequestStatus userPermissionsStatus = api.repositoryApi().createPermissionsByUser(project, repo, "REPO_READ", testUser.slug()); assertThat(userPermissionsStatus).isNotNull(); assertThat(userPermissionsStatus.value()).isNotNull(); assertThat(userPermissionsStatus.errors()).isEmpty(); final CreateParticipants createParticipants = CreateParticipants.create(testUser, participants.lastReviewedCommit(), Participants.Role.REVIEWER, participants.approved(), participants.status()); final Participants localParticipants = api().assignParticipant(project, repo, prId, createParticipants); assertThat(localParticipants).isNotNull(); assertThat(localParticipants.errors()).isEmpty(); }
public void testListBranches() throws Exception { final MockWebServer server = mockWebServer(); server.enqueue(new MockResponse().setBody(payloadFromResource("/branch-list.json")).setResponseCode(200)); try (final BitbucketApi baseApi = api(server.getUrl("/"))) { final BranchPage branch = baseApi.branchApi().list(projectKey, repoKey, null, null, null, null, null, 1); assertThat(branch).isNotNull(); assertThat(branch.errors().isEmpty()).isTrue(); assertThat(branch.values().size() > 0).isTrue(); assertThat("hello-world".equals(branch.values().get(0).displayId())).isTrue(); assertThat(branch.values().get(0).metadata()).isNotNull(); final String jiraIssuesKey = "com.atlassian.bitbucket.server.bitbucket-jira:branch-list-jira-issues"; final String commitInfoKey = "com.atlassian.bitbucket.server.bitbucket-branch:latest-commit-metadata"; final String buildStatusKey = "com.atlassian.bitbucket.server.bitbucket-build:build-status-metadata"; assertThat(branch.values().get(0).metadata().containsKey(jiraIssuesKey)).isNotNull(); assertThat(branch.values().get(0).metadata().containsKey(commitInfoKey)).isNotNull(); assertThat(branch.values().get(0).metadata().containsKey(buildStatusKey)).isNotNull(); final JsonObject buildStatusMetadata = ((JsonElement)branch.values().get(0).metadata().get(buildStatusKey)).getAsJsonObject(); final int success = buildStatusMetadata.get("successful").getAsInt(); assertThat(success).isEqualTo(1); final Map<String, ?> queryParams = ImmutableMap.of(localLimit, 1); assertSent(server, localGetMethod, restBasePath + BitbucketApiMetadata.API_VERSION + localProjectsPath + projectKey + localReposPath + repoKey + localBranchesPath, queryParams); } finally { server.shutdown(); } }