@Test public void testExportLogsAndStats() throws Exception { connectIfNeeded(); connector.executeAndAssertThat("export logs").statusIsSuccess(); String zipPath = getZipPathFromCommandResult(connector.getGfshOutput()); Set<String> actualZipEnries = getZipEntries(zipPath); Set<String> expectedFiles = Sets.newHashSet( "locator-0" + File.separator + "locator-0.log", "server-1" + File.separator + "server-1.log", "server-1" + File.separator + "statistics.gfs"); assertThat(actualZipEnries).containsAll(expectedFiles); // remove pulse.log if present actualZipEnries = actualZipEnries.stream().filter(x -> !x.endsWith("pulse.log")).collect(toSet()); assertThat(actualZipEnries).hasSize(3); }
@Test public void testExportLogsOnly() throws Exception { connectIfNeeded(); connector.executeAndAssertThat("export logs --logs-only").statusIsSuccess(); String zipPath = getZipPathFromCommandResult(connector.getGfshOutput()); Set<String> actualZipEnries = getZipEntries(zipPath); Set<String> expectedFiles = Sets.newHashSet( "locator-0" + File.separator + "locator-0.log", "server-1" + File.separator + "server-1.log"); assertThat(actualZipEnries).containsAll(expectedFiles); // remove pulse.log if present actualZipEnries = actualZipEnries.stream().filter(x -> !x.endsWith("pulse.log")).collect(toSet()); assertThat(actualZipEnries).hasSize(2); }
@Test public void getMetricKeys_includes_metrics_from_qgate() { Set<String> metricKeys = ImmutableSet.of("foo", "bar", "baz"); Set<Condition> conditions = metricKeys.stream().map(key -> { Condition condition = mock(Condition.class); when(condition.getMetricKey()).thenReturn(key); return condition; }).collect(Collectors.toSet()); QualityGate gate = mock(QualityGate.class); when(gate.getConditions()).thenReturn(conditions); assertThat(underTest.getMetricKeys(gate)).containsAll(metricKeys); }
private void getHeapCriticalMembersFrom_returnsNonEmptySet(Set adviseCriticalMembers, Set argSet, Set expectedResult) { when(resourceAdvisor.adviseCriticalMembers()).thenReturn(adviseCriticalMembers); Set<DistributedMember> criticalMembers = heapMonitor.getHeapCriticalMembersFrom(argSet); assertThat(criticalMembers).containsAll(expectedResult); }
private void runTest(ITestNGMethod testNGMethod, ParameterHolder.ParameterOrigin origin) { ParameterHandler.ParameterBag params = invokeParameterCreation(testNGMethod); assertThat(params.parameterHolder).isNotNull(); assertThat(params.parameterHolder.origin).isEqualByComparingTo(origin); Iterator<Object[]> iterators = params.parameterHolder.parameters; assertThat(iterators).containsAll(Collections.singletonList(new Object[] {"bar"})); }
@Test public void keepAuthorizedProjectIds_returns_any_public_project_for_group_AnyOne_without_any_permission_in_DB_and_permission_USER() { assertThat(underTest.keepAuthorizedProjectIds(dbSession, randomPublicProjectIds, null, UserRole.USER)) .containsAll(randomPublicProjectIds); }
@Test public void keepAuthorizedProjectIds_returns_any_public_project_for_group_AnyOne_without_any_permission_in_DB_and_permission_CODEVIEWER() { assertThat(underTest.keepAuthorizedProjectIds(dbSession, randomPublicProjectIds, null, UserRole.CODEVIEWER)) .containsAll(randomPublicProjectIds); }
/** * This uses a naming convention for the ids of the appendix to ensure that the entire appendix is documented. * The naming convention for the ids is documented in {@link Element#getIds()}. * @return */ @Test public void countReferencesWhenReviewingDocumentationThenEntireSchemaIsIncluded() throws IOException { Map<String, Element> elementsByElementName = this.xml.elementsByElementName(this.schemaDocumentLocation); List<String> documentIds = Files.lines(Paths.get(this.referenceLocation)) .filter(line -> line.matches("\\[\\[(nsa-.*)\\]\\]")) .map(line -> line.substring(2, line.length() - 2)) .collect(Collectors.toList()); Set<String> expectedIds = elementsByElementName.values().stream() .flatMap(element -> element.getIds().stream()) .collect(Collectors.toSet()); documentIds.removeAll(this.ignoredIds); expectedIds.removeAll(this.ignoredIds); assertThat(documentIds).containsAll(expectedIds); assertThat(expectedIds).containsAll(documentIds); }
@Test public void keepAuthorizedProjectIds_returns_any_public_project_for_user_without_any_permission_in_DB_and_permission_CODEVIEWER() { assertThat(underTest.keepAuthorizedProjectIds(dbSession, randomPublicProjectIds, user.getId(), UserRole.CODEVIEWER)) .containsAll(randomPublicProjectIds); }
@Test public void keepAuthorizedProjectIds_returns_any_public_project_for_user_without_any_permission_in_DB_and_permission_USER() { assertThat(underTest.keepAuthorizedProjectIds(dbSession, randomPublicProjectIds, user.getId(), UserRole.USER)) .containsAll(randomPublicProjectIds); }
@Test public void keepAuthorizedUsersForRoleAndProject_returns_any_users_for_public_project_without_any_permission_in_DB_and_permission_CODEVIEWER() { ComponentDto project = db.components().insertPublicProject(organization); assertThat(underTest.keepAuthorizedUsersForRoleAndProject(dbSession, randomExistingUserIds, UserRole.CODEVIEWER, project.getId())) .containsAll(randomExistingUserIds); }
@Test public void keepAuthorizedUsersForRoleAndProject_returns_any_users_for_public_project_without_any_permission_in_DB_and_permission_USER() { ComponentDto project = db.components().insertPublicProject(organization); assertThat(underTest.keepAuthorizedUsersForRoleAndProject(dbSession, randomExistingUserIds, UserRole.USER, project.getId())) .containsAll(randomExistingUserIds); }
private void assertContains(final Collection<Class<?>> expected, final Collection<Class<?>> actual) { assertThat(actual).containsAll(expected); }
private void assertThatMetricsArePresent(ImmutableSet<String> poolNames) { assertThat(taggedMetricRegistry.getMetrics().keySet()).containsAll( poolNames.stream().map(this::getPoolMetricName).collect(Collectors.toSet())); }
assertThat(this.topics) .as("topic(s):'" + diff + "' are not in embedded topic list") .containsAll(new HashSet<>(Arrays.asList(topics))); final AtomicBoolean assigned = new AtomicBoolean(); consumer.subscribe(Arrays.asList(topics), new ConsumerRebalanceListener() {
@Test public void shouldReturnRequestedMutators() { assertThat(parseStrings("MATH", "INVERT_NEGS")).containsAll( Arrays.asList(MathMutator.MATH_MUTATOR, InvertNegsMutator.INVERT_NEGS_MUTATOR)); }
@Test public void generatedInterfaceHasInterfaceMethods() { Set<String> generatedMethods = TestingUtils.extractMethods(AutoDelegate_GenericsTester.class); Set<String> originalMethods = TestingUtils.extractNonStaticMethods(GenericsTester.class); assertThat(generatedMethods).containsAll(originalMethods); }
@Test public void shouldNotFilterNotStaticMutants() { final Collection<MutationDetails> unmarked = aMutationDetail() .build(2); assertThat(this.testee.intercept(unmarked, null)).containsAll(unmarked); }
@Test public void shouldNotFilterMutationsInLineZeroOfAJavaClass() { final List<MutationDetails> mutations = MutationDetailsMother.aMutationDetail() .withFilename("Foo.java") .withLineNumber(0) .build(0); assertThat(this.testee.intercept(mutations, this.unused)).containsAll(mutations); }
@Test public void shouldNotFilterMutationsOhterLinesOfAKotlinClass() { final List<MutationDetails> mutations = MutationDetailsMother.aMutationDetail() .withFilename("Foo.kt") .withLineNumber(1) .build(0); assertThat(this.testee.intercept(mutations, this.unused)).containsAll(mutations); }