@Test public void toBoolean() { assertThat(RubyUtils.toBoolean(null)).isNull(); assertThat(RubyUtils.toBoolean("")).isNull(); assertThat(RubyUtils.toBoolean(" ")).isNull(); assertThat(RubyUtils.toBoolean("true")).isTrue(); assertThat(RubyUtils.toBoolean(true)).isTrue(); assertThat(RubyUtils.toBoolean("false")).isFalse(); assertThat(RubyUtils.toBoolean(false)).isFalse(); }
@Test public void test() { assertThat(BooleanUtil.toBoolean("True")).isTrue(); assertThat(BooleanUtil.toBoolean("tre")).isFalse(); assertThat(BooleanUtil.toBoolean(null)).isFalse(); assertThat(BooleanUtil.toBooleanObject("True")).isTrue(); assertThat(BooleanUtil.toBooleanObject("tre")).isFalse(); assertThat(BooleanUtil.toBooleanObject(null)).isNull(); assertThat(BooleanUtil.parseGeneralString("1", false)).isFalse(); assertThat(BooleanUtil.parseGeneralString("y", false)).isTrue(); assertThat(BooleanUtil.parseGeneralString("y")).isTrue(); assertThat(BooleanUtil.parseGeneralString("x")).isNull(); }
@Test public void defaultRegionFunctionArgs() throws Exception { assertThat(args.getDiskSynchronous()).isNull(); assertThat(args.getCloningEnabled()).isNull(); assertThat(args.getConcurrencyChecksEnabled()).isNull(); assertThat(args.getConcurrencyLevel()).isNull(); assertThat(args.getPartitionArgs()).isNull(); assertThat(args.hasPartitionAttributes()).isFalse(); assertThat(args.getEvictionAttributes()).isNull(); }
@Test public void createTreeMapByDefaultConstructor_hasModeAndStickyAndRoundAndRatioAreNulls() { //given treeMap = createWidget(); //then assertThat(treeMap.getMode()).isNull(); assertThat(treeMap.getRatio()).isNull(); assertThat(treeMap.getSticky()).isNull(); assertThat(treeMap.getRound()).isNull(); }
assertThat(FooBar.FooBarBazEnum.FOO.foreign_enum_value_option).isNull(); assertThat(FooBar.FooBarBazEnum.BAR.enum_value_option).isNull(); assertThat(FooBar.FooBarBazEnum.BAR.foreign_enum_value_option).isTrue();
@Test public void getRedirectOutputReturnsNullByDefault() { assertThat(new Builder().getRedirectOutput()).isNull(); }
@Test public void getRedirectOutputReturnsNullByDefault() throws Exception { assertThat(new LocatorLauncher.Builder().getRedirectOutput()).isNull(); }
@Test public void null_param() { assertThat(underTest.param("a_string")).isNull(); assertThat(underTest.paramAsBoolean("a_boolean")).isNull(); assertThat(underTest.paramAsInt("a_number")).isNull(); assertThat(underTest.paramAsLong("a_number")).isNull(); }
@Test public void create_empty_query() { RuleQuery result = execute(); assertThat(result.getKey()).isNull(); assertThat(result.getActivation()).isNull(); assertThat(result.getActiveSeverities()).isNull(); assertThat(result.isAscendingSort()).isTrue(); assertThat(result.getAvailableSinceLong()).isNull(); assertThat(result.getInheritance()).isNull(); assertThat(result.includeExternal()).isFalse(); assertThat(result.isTemplate()).isNull(); assertThat(result.getLanguages()).isNull(); assertThat(result.getQueryText()).isNull(); assertThat(result.getQProfile()).isNull(); assertThat(result.getRepositories()).isNull(); assertThat(result.getRuleKey()).isNull(); assertThat(result.getSeverities()).isNull(); assertThat(result.getStatuses()).isEmpty(); assertThat(result.getTags()).isNull(); assertThat(result.templateKey()).isNull(); assertThat(result.getTypes()).isEmpty(); assertThat(result.getSortField()).isNull(); assertThat(result.getCompareToQProfile()).isNull(); }
@Test public void test_default_query() { IssueQuery query = IssueQuery.builder().build(); assertThat(query.issueKeys()).isEmpty(); assertThat(query.projectUuids()).isEmpty(); assertThat(query.componentUuids()).isEmpty(); assertThat(query.moduleUuids()).isEmpty(); assertThat(query.statuses()).isEmpty(); assertThat(query.assignees()).isEmpty(); assertThat(query.resolutions()).isEmpty(); assertThat(query.rules()).isEmpty(); assertThat(query.severities()).isEmpty(); assertThat(query.languages()).isEmpty(); assertThat(query.tags()).isEmpty(); assertThat(query.types()).isEmpty(); assertThat(query.organizationUuid()).isNull(); assertThat(query.branchUuid()).isNull(); assertThat(query.assigned()).isNull(); assertThat(query.createdAfter()).isNull(); assertThat(query.createdBefore()).isNull(); assertThat(query.resolved()).isNull(); assertThat(query.sort()).isNull(); assertThat(query.createdAfterByProjectUuids()).isEmpty(); }
@Test public void activation_is_set_to_null_when_not_member_of_paid_organization() { OrganizationDto organization = db.organizations().insert(o -> o.setSubscription(PAID)); QProfileDto profile = db.qualityProfiles().insert(organization, p -> p.setName("Sonar way").setLanguage("xoo").setKee("sonar-way")); RuleQuery result = execute( PARAM_ACTIVATION, "true", PARAM_QPROFILE, profile.getKee()); assertThat(result.getActivation()).isNull(); }
assertThat(task.getSetPreAllocateLength()).isNull(); task = new DownloadTask .Builder("https://jacksgong.com", "not-exist", null)
private RegularStatement statementWithIdempotency(Boolean idempotency) { RegularStatement statement = new SimpleStatement("fake statement"); if (idempotency != null) { statement.setIdempotent(idempotency); assertThat(statement.isIdempotent()).isEqualTo(idempotency); } else { assertThat(statement.isIdempotent()).isNull(); } return statement; } }
@Test(groups = "unit") public void isIdempotent_should_return_override_flag_if_calculated_idempotency_null() { TestBatch batch = createBatch(); assertThat(batch.isIdempotent()).isTrue(); batch.add(statementWithIdempotency(null)); assertThat(batch.isIdempotent()).isNull(); batch.setIdempotent(false); assertThat(batch.isIdempotent()).isFalse(); }
@Test(groups = "unit") public void isIdempotent_should_return_null_if_no_nonidempotent_statements_and_some_are_nullidempotent() { TestBatch batch = createBatch(); assertThat(batch.isIdempotent()).isTrue(); batch.add(statementWithIdempotency(true)); assertThat(batch.isIdempotent()).isTrue(); batch.add(statementWithIdempotency(null)); assertThat(batch.isIdempotent()).isNull(); batch.add(statementWithIdempotency(true)); assertThat(batch.isIdempotent()).isNull(); }
@Test(groups = "unit") public void isIdempotent_should_return_false_if_both_nonidempotent_and_nullidempotent_statements_present() { TestBatch batch = createBatch(); assertThat(batch.isIdempotent()).isTrue(); batch.add(statementWithIdempotency(true)); assertThat(batch.isIdempotent()).isTrue(); batch.add(statementWithIdempotency(null)); assertThat(batch.isIdempotent()).isNull(); batch.add(statementWithIdempotency(false)); assertThat(batch.isIdempotent()).isFalse(); batch.add(statementWithIdempotency(true)); assertThat(batch.isIdempotent()).isFalse(); batch.add(statementWithIdempotency(null)); assertThat(batch.isIdempotent()).isFalse(); batch.add(statementWithIdempotency(false)); assertThat(batch.isIdempotent()).isFalse(); }
private RegularStatement statementWithIdempotency(Boolean idempotency) { RegularStatement statement = new SimpleStatement("fake statement"); if (idempotency != null) { statement.setIdempotent(idempotency); assertThat(statement.isIdempotent()).isEqualTo(idempotency); } else { assertThat(statement.isIdempotent()).isNull(); } return statement; } }
@Test(groups = "unit") public void isIdempotent_should_return_override_flag_if_calculated_idempotency_null() { TestBatch batch = createBatch(); assertThat(batch.isIdempotent()).isTrue(); batch.add(statementWithIdempotency(null)); assertThat(batch.isIdempotent()).isNull(); batch.setIdempotent(false); assertThat(batch.isIdempotent()).isFalse(); }