本文整理了Java中org.assertj.core.api.MapAssert.isEmpty()
方法的一些代码示例,展示了MapAssert.isEmpty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MapAssert.isEmpty()
方法的具体详情如下:
包路径:org.assertj.core.api.MapAssert
类名称:MapAssert
方法名:isEmpty
暂无
代码示例来源:origin: SonarSource/sonarqube
@Test
public void test_loadAll_with_no_properties() {
Map<String, String> map = underTest.loadAll();
assertThat(map).isEmpty();
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void empty_parts_and_params_by_default() {
PostRequest request = new PostRequest("api/issues/search");
assertThat(request.getParts()).isEmpty();
assertThat(request.getParams()).isEmpty();
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void test_defaults() {
assertThat(underTest.getMethod()).isEqualTo(WsRequest.Method.GET);
assertThat(underTest.getParams()).isEmpty();
assertThat(underTest.getMediaType()).isEqualTo(MediaTypes.JSON);
assertThat(underTest.getPath()).isEqualTo("api/foo");
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void test_parse_empty() {
diffs = FieldDiffs.parse("");
assertThat(diffs.diffs()).isEmpty();
}
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void null_param_value() {
Boolean nullBool = null;
underTest.setParam("key", nullBool);
assertThat(underTest.getParams()).isEmpty();
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void getCumulativeDurations_returns_an_empty_map_when_computation_is_disabled_in_constructor() {
VisitorsCrawler underTest = new VisitorsCrawler(Arrays.asList(spyPreOrderTypeAwareVisitor, spyPostOrderTypeAwareVisitor), false);
underTest.visit(COMPONENT_TREE);
assertThat(underTest.getCumulativeDurations()).isEmpty();
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void getCumulativeDurations_returns_an_empty_map_when_computation_is_disabled_in_constructor() {
VisitorsCrawler underTest = new VisitorsCrawler(Arrays.asList(spyPreOrderTypeAwareVisitor, spyPostOrderTypeAwareVisitor), false);
underTest.visit(COMPONENT_TREE);
assertThat(underTest.getCumulativeDurations()).isEmpty();
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void simple_tracking() {
rawIssues.add(createIssue(1, RuleTesting.XOO_X1));
Tracking<DefaultIssue, DefaultIssue> tracking = underTest.track(FILE);
assertThat(tracking.getUnmatchedBases()).isEmpty();
assertThat(tracking.getMatchedRaws()).isEmpty();
assertThat(tracking.getUnmatchedRaws()).containsOnly(rawIssues.get(0));
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void getProperties_return_empty_if_DB_error_on_first_call_ever_out_of_thread_cache() {
SettingLoader settingLoaderMock = mock(SettingLoader.class);
PersistenceException toBeThrown = new PersistenceException("Faking an error connecting to DB");
doThrow(toBeThrown).when(settingLoaderMock).loadAll();
underTest = new ThreadLocalSettings(new PropertyDefinitions(), new Properties(), settingLoaderMock);
assertThat(underTest.getProperties())
.isEmpty();
}
代码示例来源:origin: gocd/gocd
@Test
void shouldValidateIfEverythingIsGood() {
BackupConfig backupConfig = new BackupConfig("0 0 12 * * ?", "/bin/true", false, false);
backupConfig.validate(null);
assertThat(backupConfig.errors()).isEmpty();
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void getProperties_returns_empty_if_DB_error_on_first_call_ever_in_thread_cache() {
SettingLoader settingLoaderMock = mock(SettingLoader.class);
PersistenceException toBeThrown = new PersistenceException("Faking an error connecting to DB");
doThrow(toBeThrown).when(settingLoaderMock).loadAll();
underTest = new ThreadLocalSettings(new PropertyDefinitions(), new Properties(), settingLoaderMock);
underTest.load();
assertThat(underTest.getProperties())
.isEmpty();
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void convert_data_to_map() {
underTest.setData((Map) null);
assertThat(underTest.getDataAsMap()).isEmpty();
underTest.setData(Collections.emptyMap());
assertThat(underTest.getDataAsMap()).isEmpty();
underTest.setData(ImmutableMap.of("k1", "v1", "k2", "v2"));
assertThat(underTest.getDataAsMap()).containsOnly(entry("k1", "v1"), entry("k2", "v2"));
}
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void add_does_not_assignee_if_empty_neither_globally_nor_per_assignee() {
underTest.add(new DefaultIssue().setType(randomRuleTypeExceptHotspot).setAssigneeUuid(null).setNew(new Random().nextBoolean()));
DistributedMetricStatsInt globalDistribution = underTest.globalStatistics().getDistributedMetricStats(Metric.ASSIGNEE);
assertThat(globalDistribution.getTotal()).isEqualTo(0);
assertThat(globalDistribution.getForLabel(null).isPresent()).isFalse();
assertThat(underTest.getAssigneesStatistics()).isEmpty();
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void groupByKey() {
assertThat(ActiveRuleParamDto.groupByKey(Collections.emptyList())).isEmpty();
Collection<ActiveRuleParamDto> dtos = Arrays.asList(
new ActiveRuleParamDto().setKey("foo"), new ActiveRuleParamDto().setKey("bar")
);
Map<String, ActiveRuleParamDto> group = ActiveRuleParamDto.groupByKey(dtos);
assertThat(group.keySet()).containsOnly("foo", "bar");
}
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void testContextProperties() {
assertThat(tester.getContextProperties()).isEmpty();
tester.addContextProperty("foo", "bar");
assertThat(tester.getContextProperties()).containsOnly(entry("foo", "bar"));
}
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void put_property() {
assertThat(underTest.getAll()).isEmpty();
underTest.put("foo", "bar");
assertThat(underTest.getAll()).containsOnly(entry("foo", "bar"));
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void noProfileDefinitions() {
BuiltInQProfileDefinitionsBridge bridge = new BuiltInQProfileDefinitionsBridge();
BuiltInQualityProfilesDefinition.Context context = new BuiltInQualityProfilesDefinition.Context();
bridge.define(context);
assertThat(context.profilesByLanguageAndName()).isEmpty();
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void setCharacteristics_null_is_considered_as_empty() {
CeTask task = underTest.setOrganizationUuid("org1").setType("TYPE_1").setUuid("UUID_1")
.setCharacteristics(null)
.build();
assertThat(task.getCharacteristics()).isEmpty();
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void return_nothing_on_unknown_project() {
OrganizationDto organization = dbTester.organizations().insert();
ComponentDto project = dbTester.components().insertPrivateProject(organization);
dbTester.components().insertSnapshot(project);
Map<String, ProjectMeasures> docsById = createResultSetAndReturnDocsById("UNKNOWN");
assertThat(docsById).isEmpty();
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void does_not_fail_when_quality_gate_has_no_value() {
OrganizationDto organization = dbTester.organizations().insert();
ComponentDto project = dbTester.components().insertPrivateProject(organization);
MetricDto metric = dbTester.measures().insertMetric(m -> m.setValueType(LEVEL.name()).setKey("alert_status"));
dbTester.measures().insertLiveMeasure(project, metric, m -> m.setValue(null).setVariation(null).setData((String) null));
Map<String, ProjectMeasures> docsById = createResultSetAndReturnDocsById();
assertThat(docsById.get(project.uuid()).getMeasures().getNumericMeasures()).isEmpty();
}
内容来源于网络,如有侵权,请联系作者删除!