private void assertNotPublished() { assertThat(temp.getRoot().list()).isEmpty(); }
@Test public void shouldGetEmptyList() { Map<String, String> props = new HashMap<>(); props.put("prop", ""); assertThat(ProjectReactorBuilder.getListFromProperty(props, "prop")).isEmpty(); }
@Test public void multiplePatterns() { WildcardPattern[] patterns = WildcardPattern.create(new String[] {"Foo", "Bar"}); assertThat(WildcardPattern.match(patterns, "Foo")).isTrue(); assertThat(WildcardPattern.match(patterns, "Bar")).isTrue(); assertThat(WildcardPattern.match(patterns, "Other")).isFalse(); assertThat(WildcardPattern.create((String[]) null)).isEmpty(); }
@Test public void getStringArray_no_value() { Settings settings = new MapSettings(); String[] array = settings.getStringArray("array"); assertThat(array).isEmpty(); }
@Test public void no_handlers() { SettingsChangeNotifier notifier = new SettingsChangeNotifier(); assertThat(notifier.changeHandlers).isEmpty(); // does not fail notifier.onGlobalPropertyChange("foo", "bar"); } }
@Test public void tryLock() { assertThat(temp.getRoot().list()).isEmpty(); lock.tryLock(); assertThat(temp.getRoot().toPath().resolve(".sonar_lock")).exists(); lock.unlock(); }
@Test public void should_not_fail_if_no_decorations() { assertThat(new PageDecorations().get()).isEmpty(); }
@Test public void test_simplest_transition() { Transition transition = Transition.builder("close") .from("OPEN").to("CLOSED") .build(); assertThat(transition.key()).isEqualTo("close"); assertThat(transition.from()).isEqualTo("OPEN"); assertThat(transition.to()).isEqualTo("CLOSED"); assertThat(transition.conditions()).isEmpty(); assertThat(transition.functions()).isEmpty(); assertThat(transition.requiredProjectPermission()).isNull(); }
@Test public void cleanup_static_directory_if_already_exists() throws Exception { File dir = temp.newFolder(); FileUtils.touch(new File(dir, "foo.txt")); underTest.addStaticDir(tomcat, "/deploy", dir); assertThat(dir).isDirectory().exists(); assertThat(dir.listFiles()).isEmpty(); }
@Test //https://github.com/reactor/reactor-core/issues/1326 public void toArrayOnZeroQueueShouldNotFailAlsoOnJava9() { Queue<Integer> emptyQueue = Queues.<Integer>empty().get(); assertThat(emptyQueue.toArray(new Integer[0])).as("toArray(empty)").isEmpty(); }
@Test public void get_string_array_value() throws Exception { underTest.setValue("key", "value1,value2"); assertThat(underTest.getStringArray("key")).containsOnly("value1", "value2"); assertThat(underTest.getStringArray("unknown")).isEmpty(); } }
@Test public void test_no_languages() { Languages languages = new Languages(); assertThat(languages.get("foo")).isNull(); assertThat(languages.getSuffixes("foo")).isEmpty(); }
@Test public void load_exclusions() { MapSettings settings = new MapSettings(); settings.setProperty(CoreProperties.PROJECT_EXCLUSIONS_PROPERTY, "**/*Foo.java"); settings.setProperty(CoreProperties.PROJECT_TEST_EXCLUSIONS_PROPERTY, "**/*FooTest.java"); FileExclusions moduleExclusions = new FileExclusions(settings.asConfig()); assertThat(moduleExclusions.sourceInclusions()).isEmpty(); assertThat(moduleExclusions.sourceExclusions()).containsOnly("**/*Foo.java"); assertThat(moduleExclusions.testInclusions()).isEmpty(); assertThat(moduleExclusions.testExclusions()).containsOnly("**/*FooTest.java"); } }
@Test public void ignore_inclusion_of_world() { MapSettings settings = new MapSettings(); settings.setProperty(CoreProperties.PROJECT_INCLUSIONS_PROPERTY, "**/*"); settings.setProperty(CoreProperties.PROJECT_TEST_INCLUSIONS_PROPERTY, "**/*"); assertThat(new FileExclusions(settings.asConfig()).sourceInclusions()).isEmpty(); assertThat(new FileExclusions(settings.asConfig()).testInclusions()).isEmpty(); }
@Test public void testAlwaysTrustManager() { HttpsTrust.AlwaysTrustManager manager = new HttpsTrust.AlwaysTrustManager(); assertThat(manager.getAcceptedIssuers()).isEmpty(); // does nothing manager.checkClientTrusted(null, null); manager.checkServerTrusted(null, null); }
@Test public void should_get_suffixes() { Languages languages = new Languages( language("java", "java"), language("php", "php4", "php5")); assertThat(languages.getSuffixes()).containsOnly("java", "php4", "php5"); assertThat(languages.getSuffixes("java")).containsOnly("java"); assertThat(languages.getSuffixes("php")).containsOnly("php4", "php5"); assertThat(languages.getSuffixes("xxx")).isEmpty(); }
@Test public void get_string_array_settings() { MapSettings serverSettings = new MapSettings(); serverSettings.setProperty("prop", "1,3.4,8,50"); when(settingsRepository.getConfiguration()).thenReturn(serverSettings.asConfig()); MeasureComputerContextImpl underTest = newContext(FILE_1_REF); assertThat(underTest.getSettings().getStringArray("prop")).containsExactly("1", "3.4", "8", "50"); assertThat(underTest.getSettings().getStringArray("unknown")).isEmpty(); }
private void assertMemberInIndex(String organizationUuid, UserDto user, boolean isMember) { SearchRequestBuilder request = es.client().prepareSearch(UserIndexDefinition.INDEX_TYPE_USER) .setQuery(boolQuery() .must(termQuery(FIELD_ORGANIZATION_UUIDS, organizationUuid)) .must(termQuery(FIELD_UUID, user.getUuid()))); if (isMember) { assertThat(request.get().getHits().getHits()).hasSize(1); } else { assertThat(request.get().getHits().getHits()).isEmpty(); } }
@Test public void findById_populates_system_tags_but_not_tags() { RuleDefinitionDto ruleDefinition = dbTester.rules() .insert(t -> t.setSystemTags(ImmutableSet.of(randomAlphanumeric(5), randomAlphanumeric(6)))); OrganizationDto organization = dbTester.organizations().insert(); dbTester.rules().insertRule(organization); Rule rule = underTest.findById(ruleDefinition.getId()); assertThat(rule.getSystemTags()) .containsOnlyElementsOf(ruleDefinition.getSystemTags()); assertThat(rule.getTags()).isEmpty(); }