本文整理了Java中org.assertj.core.api.ListAssert.allMatch()
方法的一些代码示例,展示了ListAssert.allMatch()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ListAssert.allMatch()
方法的具体详情如下:
包路径:org.assertj.core.api.ListAssert
类名称:ListAssert
方法名:allMatch
暂无
代码示例来源:origin: SonarSource/sonarqube
@Test
public void getOwaspTop10Report_aggregation_no_cwe() {
List<SecurityStandardCategoryStatistics> owaspTop10Report = indexIssuesAndAssertOwaspReport(false);
assertThat(owaspTop10Report).allMatch(category -> category.getChildren().isEmpty());
}
代码示例来源:origin: jdbi/jdbi
@Test
public void testStatement() {
h.createUpdate(CREATE).define("x", "foo").execute();
assertThat(logger.getAttributes())
.hasSize(2)
.allMatch(x -> x.get("x").equals("foo"))
.allMatch(x -> x.size() == 1);
}
代码示例来源:origin: kiegroup/jbpm
@Test
public void testGroupsForUserWithCommaInDN() {
UserGroupCallback ldapUserGroupCallback = createLdapUserGroupCallback(Configuration.CUSTOM);
Assertions.assertThat(ldapUserGroupCallback).isNotNull();
List<String> userGroups = ldapUserGroupCallback.getGroupsForUser("john,jr");
Assertions.assertThat(userGroups).hasSize(1).allMatch(s -> s.equals("manager,eng"));
}
代码示例来源:origin: jdbi/jdbi
@Test
public void testSomethingByIterableHandleVoidWithEmptyList() {
final List<String> log = new ArrayList<>();
handle.setSqlParser(new LoggingParser(log));
final SomethingByIterableHandleVoid s = handle.attach(SomethingByIterableHandleVoid.class);
final List<Something> out = s.get(new ArrayList<>());
assertThat(out).isEmpty();
assertThat(log).hasSize(1).allMatch(e -> e.contains(" where id in ();"));
}
代码示例来源:origin: jdbi/jdbi
@Test
public void testBatch() {
h.createBatch().add(CREATE).define("x", "foo").execute();
assertThat(logger.getAttributes())
.hasSize(2)
.allMatch(x -> x.get("x").equals("foo"))
.allMatch(x -> x.size() == 1);
}
代码示例来源:origin: jdbi/jdbi
@Test
public void testSomethingByIterableHandleVoidWithNull() {
final List<String> log = new ArrayList<>();
handle.setSqlParser(new LoggingParser(log));
final SomethingByIterableHandleVoid s = handle.attach(SomethingByIterableHandleVoid.class);
final List<Something> out = s.get(null);
assertThat(out).isEmpty();
assertThat(log).hasSize(1).allMatch(e -> e.contains(" where id in ();"));
}
代码示例来源:origin: jdbi/jdbi
@Test
public void testStatementException() {
h.execute(CREATE);
Throwable e = catchThrowable(h.createUpdate(INSERT_NULL)::execute);
assertThat(e)
.isInstanceOf(RuntimeException.class)
.hasCauseInstanceOf(SQLException.class);
assertThat(logger.getRawSql()).containsExactly(CREATE, CREATE, INSERT_NULL, INSERT_NULL);
assertThat(logger.getTimings()).hasSize(2).allMatch(IS_POSITIVE);
assertThat(logger.getExceptions()).containsExactly((SQLException) e.getCause());
}
代码示例来源:origin: jdbi/jdbi
@Test
public void testPreparedBatchException() {
h.execute(CREATE);
Throwable e = catchThrowable(h.prepareBatch(INSERT_PREPARED).bindByType(0, null, Integer.class)::execute);
assertThat(logger.getRawSql()).containsExactly(CREATE, CREATE, INSERT_PREPARED, INSERT_PREPARED);
assertThat(logger.getTimings()).hasSize(2).allMatch(IS_POSITIVE);
assertThat(logger.getExceptions()).containsExactly((SQLException) e.getCause());
}
代码示例来源:origin: jdbi/jdbi
@Test
public void testBatchException() {
h.execute(CREATE);
Throwable e = catchThrowable(h.createBatch().add(INSERT_NULL)::execute);
// unfortunately...
assertThat(logger.getRawSql()).containsExactly(CREATE, CREATE, null, null);
assertThat(logger.getTimings()).hasSize(2).allMatch(IS_POSITIVE);
assertThat(logger.getExceptions()).containsExactly((SQLException) e.getCause());
}
代码示例来源:origin: jdbi/jdbi
@Test
public void testStatement() {
h.execute(CREATE);
h.createUpdate(INSERT).execute();
assertThat(logger.getRawSql()).containsExactly(CREATE, CREATE, INSERT, INSERT);
assertThat(logger.getTimings()).hasSize(2).allMatch(IS_POSITIVE);
assertThat(logger.getExceptions()).isEmpty();
}
代码示例来源:origin: jdbi/jdbi
@Test
public void testBatch() {
h.execute(CREATE);
h.createBatch().add(INSERT).execute();
// unfortunately...
assertThat(logger.getRawSql()).containsExactly(CREATE, CREATE, null, null);
assertThat(logger.getTimings()).hasSize(2).allMatch(IS_POSITIVE);
assertThat(logger.getExceptions()).isEmpty();
}
代码示例来源:origin: jdbi/jdbi
@Test
public void testPreparedBatch() {
h.execute(CREATE);
h.prepareBatch(INSERT_PREPARED).bind(0, 1).execute();
assertThat(logger.getRawSql()).containsExactly(CREATE, CREATE, INSERT_PREPARED, INSERT_PREPARED);
assertThat(logger.getTimings()).hasSize(2).allMatch(IS_POSITIVE);
assertThat(logger.getExceptions()).isEmpty();
}
代码示例来源:origin: reactor/reactor-core
@Test
public void raceRequest() {
List<Long> requests = Collections.synchronizedList(new ArrayList<>());
final Flux<Integer> flux = Flux.range(1, 1000)
.doOnRequest(requests::add)
.limitRequest(81);
BaseSubscriber<Integer> base = new BaseSubscriber<Integer>() {
@Override
protected void hookOnSubscribe(Subscription subscription) {
}
};
flux.subscribe(base);
for (int i = 0; i < 11; i++) {
final int idx = i;
RaceTestUtils.race(
() -> base.request(idx % 2 == 0 ? 10 : 8),
() -> base.request(8)
);
}
assertThat(requests.stream().mapToLong(l -> l).sum())
.as("total request should match the limitRequest")
.isEqualTo(81);
assertThat(requests.subList(0, requests.size() - 2))
.allMatch(l -> l % 2 == 0, "all requests except last two are even");
assertThat(requests)
.filteredOn(l -> l % 2 == 1)
.as("only one odd element toward end")
.hasSize(1);
}
代码示例来源:origin: jdbi/jdbi
@Test
public void testPreparedBatch() {
h.configure(SqlStatements.class, c -> c.setSqlLogger(SqlLogger.NOP_SQL_LOGGER));
h.createUpdate(CREATE).define("x", "foo").execute();
h.configure(SqlStatements.class, c -> c.setSqlLogger(logger));
int id = 0;
h.prepareBatch("insert into <x>(bar) values(?)")
.define("x", "foo")
.bind(0, new Argument() {
@Override
public void apply(int position, PreparedStatement statement, StatementContext ctx) throws SQLException {
statement.setInt(1, id);
}
@Override
public String toString() {
return Objects.toString(id);
}
})
.execute();
assertThat(logger.getAttributes())
.hasSize(2)
.allMatch(x -> x.get("x").equals("foo"))
.allMatch(x -> x.size() == 1);
assertThat(logger.getBindings()).containsExactly(String.valueOf(id), String.valueOf(id));
}
代码示例来源:origin: reactor/reactor-core
.allMatch(ctx -> ctx.hasKey("thirdPartyContext"));
代码示例来源:origin: reactor/reactor-core
assertThat(finalizeStats).areAtLeast(5, hasFinalized);
assertThat(finalizeStats).allMatch(t3 -> t3.getT2() <= 3, "max 3 windows in flight");
代码示例来源:origin: reactor/reactor-core
"emitted 2 elements this attempt, 0 repeats left");
assertThat(contexts).allMatch(ctx -> ctx.hasKey("thirdPartyContext"));
代码示例来源:origin: SonarSource/sonarqube
assertThat(sansTop25Report).allMatch(category -> category.getChildren().isEmpty());
代码示例来源:origin: SonarSource/sonarqube
tuple(SANS_TOP_25_POROUS_DEFENSES, 0L, OptionalInt.empty(), 0L, 0L, 0L));
assertThat(sansTop25Report).allMatch(category -> category.getChildren().isEmpty());
代码示例来源:origin: palantir/atlasdb
@Test(timeout = 50000)
public void testSweepBatchesDownToDeleteBatchSize() {
CellsSweeper cellsSweeper = Mockito.mock(CellsSweeper.class);
SweepTaskRunner spiedSweepRunner =
new SweepTaskRunner(kvs, tsSupplier, tsSupplier, txService, ssm, cellsSweeper);
putTwoValuesInEachCell(SMALL_LIST_OF_CELLS);
int deleteBatchSize = 1;
Pair<List<List<Cell>>, SweepResults> sweptCellsAndSweepResults = runSweep(cellsSweeper, spiedSweepRunner,
8, 8, deleteBatchSize);
List<List<Cell>> sweptCells = sweptCellsAndSweepResults.getLhSide();
assertThat(sweptCells).allMatch(list -> list.size() <= 2 * deleteBatchSize);
assertThat(Iterables.concat(sweptCells)).containsExactlyElementsOf(SMALL_LIST_OF_CELLS);
}
内容来源于网络,如有侵权,请联系作者删除!