本文整理了Java中org.assertj.core.api.ListAssert.isNotEmpty()
方法的一些代码示例,展示了ListAssert.isNotEmpty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ListAssert.isNotEmpty()
方法的具体详情如下:
包路径:org.assertj.core.api.ListAssert
类名称:ListAssert
方法名:isNotEmpty
暂无
代码示例来源:origin: spring-projects/spring-security
@Test
public void antMatchersWhenHttpMethodAndPatternParamsThenReturnAntPathRequestMatcherType() {
List<RequestMatcher> requestMatchers = this.matcherRegistry.antMatchers(HttpMethod.GET, "/a.*");
assertThat(requestMatchers).isNotEmpty();
assertThat(requestMatchers.size()).isEqualTo(1);
assertThat(requestMatchers.get(0)).isExactlyInstanceOf(AntPathRequestMatcher.class);
}
代码示例来源:origin: spring-projects/spring-security
@Test
public void regexMatchersWhenPatternParamThenReturnRegexRequestMatcherType() {
List<RequestMatcher> requestMatchers = this.matcherRegistry.regexMatchers("/a.*");
assertThat(requestMatchers).isNotEmpty();
assertThat(requestMatchers.size()).isEqualTo(1);
assertThat(requestMatchers.get(0)).isExactlyInstanceOf(RegexRequestMatcher.class);
}
代码示例来源:origin: spring-projects/spring-security
@Test
public void antMatchersWhenPatternParamThenReturnAntPathRequestMatcherType() {
List<RequestMatcher> requestMatchers = this.matcherRegistry.antMatchers("/a.*");
assertThat(requestMatchers).isNotEmpty();
assertThat(requestMatchers.size()).isEqualTo(1);
assertThat(requestMatchers.get(0)).isExactlyInstanceOf(AntPathRequestMatcher.class);
}
代码示例来源:origin: spring-projects/spring-security
@Test
public void regexMatchersWhenHttpMethodAndPatternParamsThenReturnRegexRequestMatcherType() {
List<RequestMatcher> requestMatchers = this.matcherRegistry.regexMatchers(HttpMethod.GET, "/a.*");
assertThat(requestMatchers).isNotEmpty();
assertThat(requestMatchers.size()).isEqualTo(1);
assertThat(requestMatchers.get(0)).isExactlyInstanceOf(RegexRequestMatcher.class);
}
代码示例来源:origin: twosigma/beakerx
@Test
public void parsePlotWithConstantLineScript_returnPlotObjectWithConstantLine() {
//when
Object result =
parseClassFromScript("def plot = new Plot ()\n" + "plot << new ConstantLine(x: 0.65)");
//then
Assertions.assertThat(result instanceof Plot).isTrue();
Plot plot = (Plot) result;
Assertions.assertThat(plot.getConstantLines()).isNotEmpty();
Assertions.assertThat(plot.getConstantLines().get(0)).isNotNull();
}
代码示例来源:origin: twosigma/beakerx
@Test
public void parseCategoryPlotWithYAxisScript_returnCategoryPlotObjectWithYAxis() {
//when
Object result =
parseClassFromScript(
"def p = new CategoryPlot()\n" + "p << new YAxis(label: \"Volume\", upperMargin: 1)");
//then
Assertions.assertThat(result instanceof CategoryPlot).isTrue();
CategoryPlot categoryPlot = (CategoryPlot) result;
Assertions.assertThat(categoryPlot.getYAxes()).isNotEmpty();
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void ignore_deprecated_constant_per_file_function() throws Exception {
String xml = getFileContent("ignore_deprecated_constant_per_file_function.xml");
List<RuleDebt> results = underTest.importXML(xml, validationMessages);
assertThat(results).isEmpty();
assertThat(validationMessages.getWarnings()).isNotEmpty();
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void ignore_invalid_value() throws Exception {
String xml = getFileContent("ignore_invalid_value.xml");
List<RuleDebt> results = underTest.importXML(xml, validationMessages);
assertThat(results).isEmpty();
assertThat(validationMessages.getErrors()).isNotEmpty();
}
代码示例来源:origin: spring-projects/spring-security
@Test
public void mvcMatcherGetFiltersNoUnsupportedMethodExceptionFromDummyRequest() {
loadConfig(MvcMatcherConfig.class);
assertThat(springSecurityFilterChain.getFilters("/path")).isNotEmpty();
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void convert_deprecated_linear_with_threshold_function_by_linear_function() throws Exception {
String xml = getFileContent("convert_deprecated_linear_with_threshold_function_by_linear_function.xml");
List<RuleDebt> results = underTest.importXML(xml, validationMessages);
assertThat(results).hasSize(1);
RuleDebt ruleDebt = results.get(0);
assertThat(ruleDebt.function()).isEqualTo(DebtRemediationFunction.Type.LINEAR.name());
assertThat(ruleDebt.coefficient()).isEqualTo("3h");
assertThat(ruleDebt.offset()).isNull();
assertThat(validationMessages.getWarnings()).isNotEmpty();
}
代码示例来源:origin: twosigma/beakerx
@Test
public void handleMessage_shouldSendShellSocketMessage() throws Exception {
//given
Message message = JupyterHandlerTest.initOpenMessage();
//when
commOpenHandler.handle(message);
//then
Assertions.assertThat(kernel.getSentMessages()).isNotEmpty();
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void keep_existing_processed_symbols_when_range_offset_converter_throw_RangeOffsetConverterException() {
TextRange declaration = newSingleLineTextRangeWithExpectedLabel(LINE_1, OFFSET_1, OFFSET_3, RANGE_LABEL_2);
TextRange reference = newTextRange(LINE_2, LINE_2, OFFSET_1, OFFSET_3);
doThrow(RangeOffsetConverter.RangeOffsetConverterException.class).when(rangeOffsetConverter).offsetToString(reference, LINE_2, DEFAULT_LINE_LENGTH);
SymbolsLineReader symbolsLineReader = newReader(newSymbol(declaration, reference));
assertThat(symbolsLineReader.read(line1)).isEmpty();
assertThat(symbolsLineReader.read(line2)).contains(new LineReader.ReadError(SYMBOLS, LINE_2));
assertThat(line1.hasSymbols()).isTrue();
assertThat(line2.hasSymbols()).isFalse();
assertThat(logTester.logs(WARN)).isNotEmpty();
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void no_missing_dependencies_between_components() {
underTest.configureLevel();
assertThat(underTest.getAll(PropertyDefinition.class)).isNotEmpty();
assertThat(underTest.getOptional(WebServer.class)).isPresent();
assertThat(underTest.getOptional(System2.class)).isPresent();
}
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void not_fail_and_stop_processing_when_range_offset_converter_throw_RangeOffsetConverterException() {
TextRange textRange1 = newTextRange(LINE_1, LINE_1);
doThrow(RangeOffsetConverterException.class).when(rangeOffsetConverter).offsetToString(textRange1, LINE_1, DEFAULT_LINE_LENGTH);
HighlightingLineReader highlightingLineReader = newReader(of(
textRange1, HighlightingType.ANNOTATION,
newSingleLineTextRangeWithExpectingLabel(LINE_2, RANGE_LABEL_1), HIGHLIGHTING_STRING));
LineReader.ReadError readErrorLine1 = new LineReader.ReadError(HIGHLIGHTING, LINE_1);
assertThat(highlightingLineReader.read(line1)).contains(readErrorLine1);
assertThat(highlightingLineReader.read(line2)).contains(readErrorLine1);
assertNoHighlighting();
assertThat(logTester.logs(DEBUG)).isNotEmpty();
}
代码示例来源:origin: spring-projects/spring-security
@Test
public void loadConfigWhenRequestAuthenticateThenAuthenticationEventPublished() throws Exception {
this.spring.register(InMemoryAuthWithWebSecurityConfigurerAdapter.class).autowire();
this.mockMvc.perform(formLogin())
.andExpect(status().is3xxRedirection());
assertThat(InMemoryAuthWithWebSecurityConfigurerAdapter.EVENTS).isNotEmpty();
assertThat(InMemoryAuthWithWebSecurityConfigurerAdapter.EVENTS).hasSize(1);
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void not_fail_and_stop_processing_when_range_offset_converter_throw_RangeOffsetConverterException() {
TextRange declaration = newTextRange(LINE_1, LINE_1, OFFSET_1, OFFSET_3);
doThrow(RangeOffsetConverter.RangeOffsetConverterException.class).when(rangeOffsetConverter).offsetToString(declaration, LINE_1, DEFAULT_LINE_LENGTH);
TextRange reference = newSingleLineTextRangeWithExpectedLabel(LINE_2, OFFSET_1, OFFSET_3, RANGE_LABEL_2);
SymbolsLineReader symbolsLineReader = newReader(newSymbol(declaration, reference));
LineReader.ReadError readErrorLine1 = new LineReader.ReadError(SYMBOLS, LINE_1);
assertThat(symbolsLineReader.read(line1)).contains(readErrorLine1);
assertThat(symbolsLineReader.read(line2)).contains(readErrorLine1);
assertNoSymbol();
assertThat(logTester.logs(WARN)).isNotEmpty();
}
代码示例来源:origin: SonarSource/sonarqube
private void assertUserPropertyExists(String key, UserDto user) {
assertThat(dbClient.propertiesDao().selectByQuery(PropertyQuery.builder()
.setKey(key)
.setUserId(user.getId())
.build(),
dbSession)).isNotEmpty();
}
代码示例来源:origin: SonarSource/sonarqube
private void assertUserPropertyExists(String key, UserDto user) {
assertThat(dbClient.propertiesDao().selectByQuery(PropertyQuery.builder()
.setKey(key)
.setUserId(user.getId())
.build(),
dbSession)).isNotEmpty();
}
}
代码示例来源:origin: SonarSource/sonarqube
private void assertProjectPropertyExists(String key) {
assertThat(dbClient.propertiesDao().selectByQuery(PropertyQuery.builder().setComponentId(project.getId()).setKey(key).build(), dbSession)).isNotEmpty();
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void active_rules_are_returned_when_member_of_paid_organization() {
OrganizationDto organization = db.organizations().insert(o -> o.setSubscription(PAID));
RuleDefinitionDto rule = db.rules().insert();
QProfileDto qProfile = db.qualityProfiles().insert(organization);
ActiveRuleDto activeRule = db.qualityProfiles().activateRule(qProfile, rule);
userSession.logIn(db.users().insertUser()).addMembership(organization);
ShowResponse result = ws.newRequest()
.setParam(PARAM_KEY, rule.getKey().toString())
.setParam(PARAM_ACTIVES, "true")
.setParam(PARAM_ORGANIZATION, organization.getKey())
.executeProtobuf(ShowResponse.class);
assertThat(result.getActivesList()).isNotEmpty();
}
内容来源于网络,如有侵权,请联系作者删除!