作者:手机用户2602935395 | 来源:互联网 | 2023-08-26 16:47
本文整理了Java中org.assertj.core.api.ListAssert.last()
方法的一些代码示例,展示了ListAssert.last()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ListAssert.last()
方法的具体详情如下:
包路径:org.assertj.core.api.ListAssert
类名称:ListAssert
方法名:last
ListAssert.last介绍
暂无
代码示例
代码示例来源:origin: RoboZonky/robozonky
@Test
void properEventsFired() {
final RoboZonkyStartupNotifier rzsn = new RoboZonkyStartupNotifier(SESSION);
final Optional> result = rzsn.get();
assertThat(result).isPresent();
assertThat(this.getEventsRequested()).last().isInstanceOf(RoboZonkyInitializedEvent.class);
final ShutdownHook.Result r = new ShutdownHook.Result(ReturnCode.OK, null);
result.get().accept(r);
assertThat(this.getEventsRequested()).last().isInstanceOf(RoboZonkyEndingEvent.class);
final ShutdownHook.Result r2 = new ShutdownHook.Result(ReturnCode.ERROR_SETUP, null);
result.get().accept(r2);
assertThat(this.getEventsRequested()).last().isInstanceOf(RoboZonkyCrashedEvent.class);
}
}
代码示例来源:origin: RoboZonky/robozonky
@Test
void correctLoading() {
final ListenerService s1 = mock(ListenerService.class);
final EventListenerSupplier returned = () -> Optional.of(l);
doAnswer(i -> Stream.of(returned)).when(s1).findListeners(eq(RoboZonkyStartingEvent.class));
final ListenerService s2 = mock(ListenerService.class);
doAnswer(i -> Stream.of((EventListenerSupplier) Optional::empty))
.when(s2).findListeners(eq(RoboZonkyStartingEvent.class));
final Iterable s = () -> Arrays.asList(s1, s2).iterator();
final List> r =
ListenerServiceLoader.load(RoboZonkyStartingEvent.class, s);
assertThat(r).hasSize(2);
assertThat(r)
.first()
.has(new Condition<>(result -> result.get().isPresent() && Objects.equals(result.get().get(), l),
"Exists"));
assertThat(r)
.last()
.has(new Condition<>(result -> !result.get().isPresent(), "Does not exist"));
}