@BeforeEach
public void setUp()
{
- repository.deleteAll();
+ repository.deleteAll().block();
- a = repository.save(new ChatRoomTo("a", "foo"));
- b = repository.save(new ChatRoomTo("b", "bar"));
- c = repository.save(new ChatRoomTo("c", "bar"));
+ a = repository.save(new ChatRoomTo("a", "foo")).block();
+ b = repository.save(new ChatRoomTo("b", "bar")).block();
+ c = repository.save(new ChatRoomTo("c", "bar")).block();
}
@Test
public void findsAll()
{
- assertThat(repository.findAll()).containsExactly(a, b, c);
+ assertThat(repository.findAll()).emitsExactly(a, b, c);
}
@Test
public void findsById()
{
- assertThat(repository.findById("a")).contains(a);
- assertThat(repository.findById("b")).contains(b);
- assertThat(repository.findById("c")).contains(c);
- assertThat(repository.findById("666")).isEmpty();
+ assertThat(repository.findById("a")).emitsExactly(a);
+ assertThat(repository.findById("b")).emitsExactly(b);
+ assertThat(repository.findById("c")).emitsExactly(c);
+ assertThat(repository.findById("666")).emitsExactly();
}
@Test
public void findsByExample()
{
- assertThat(repository.findAll(Example.of(new ChatRoomTo(null, "foo")))).containsExactly(a);
- assertThat(repository.findAll(Example.of(new ChatRoomTo(null, "bar")))).containsExactly(b, c);
- assertThat(repository.findAll(Example.of(new ChatRoomTo(null, "foobar")))).isEmpty();
+ assertThat(repository.findAll(Example.of(new ChatRoomTo(null, "foo")))).emitsExactly(a);
+ assertThat(repository.findAll(Example.of(new ChatRoomTo(null, "bar")))).emitsExactly(b, c);
+ assertThat(repository.findAll(Example.of(new ChatRoomTo(null, "foobar")))).emitsExactly();
}
}
@BeforeEach
public void setUp()
{
- repository.deleteAll();
+ repository.deleteAll().block();
foo = UUID.randomUUID();
bar = UUID.randomUUID();
Message.MessageKey.of("peter", 1l),
serial++,
now.plusSeconds(serial),
- "Nachricht #" + serial)));
+ "Nachricht #" + serial))).block();
foo_2 = repository.save(MessageTo.from(
foo,
new Message(
Message.MessageKey.of("ute", 2l),
serial++,
now.plusSeconds(serial),
- "Nachricht #" + serial)));
+ "Nachricht #" + serial))).block();
bar_1 = repository.save(MessageTo.from(
bar,
new Message(
Message.MessageKey.of("klaus", 1l),
serial++,
now.plusSeconds(serial),
- "Nachricht #" + serial)));
+ "Nachricht #" + serial))).block();
bar_2 = repository.save(MessageTo.from(
bar,
new Message(
Message.MessageKey.of("beate", 2l),
serial++,
now.plusSeconds(serial),
- "Nachricht #" + serial)));
+ "Nachricht #" + serial))).block();
bar_3 = repository.save(MessageTo.from(
bar,
new Message(
Message.MessageKey.of("peter", 3l),
serial++,
now.plusSeconds(serial),
- "Nachricht #" + serial)));
+ "Nachricht #" + serial))).block();
}
@Test
public void findsAll()
{
- assertThat(repository.findAll()).containsExactly(foo_1, foo_2, bar_1, bar_2, bar_3);
+ assertThat(repository.findAll()).emitsExactly(foo_1, foo_2, bar_1, bar_2, bar_3);
}
@Test
public void findsByExample_chatRoomId()
{
- assertThat(repository.findAll(Example.of(new MessageTo(foo.toString(), null, null, null, null, null)))).containsExactly(foo_1, foo_2);
- assertThat(repository.findAll(Example.of(new MessageTo(bar.toString(), null, null, null, null, null)))).containsExactly(bar_1, bar_2, bar_3);
+ assertThat(repository.findAll(Example.of(new MessageTo(foo.toString(), null, null, null, null, null)))).emitsExactly(foo_1, foo_2);
+ assertThat(repository.findAll(Example.of(new MessageTo(bar.toString(), null, null, null, null, null)))).emitsExactly(bar_1, bar_2, bar_3);
}
@Test
public void findsByExample_user()
{
- assertThat(repository.findAll(Example.of(new MessageTo(null, "peter", null, null, null, null)))).containsExactly(foo_1, bar_3);
- assertThat(repository.findAll(Example.of(new MessageTo(null, "klaus", null, null, null, null)))).containsExactly(bar_1);
- assertThat(repository.findAll(Example.of(new MessageTo(null, "ute", null, null, null, null)))).containsExactly(foo_2);
- assertThat(repository.findAll(Example.of(new MessageTo(null, "beate", null, null, null, null)))).containsExactly(bar_2);
+ assertThat(repository.findAll(Example.of(new MessageTo(null, "peter", null, null, null, null)))).emitsExactly(foo_1, bar_3);
+ assertThat(repository.findAll(Example.of(new MessageTo(null, "klaus", null, null, null, null)))).emitsExactly(bar_1);
+ assertThat(repository.findAll(Example.of(new MessageTo(null, "ute", null, null, null, null)))).emitsExactly(foo_2);
+ assertThat(repository.findAll(Example.of(new MessageTo(null, "beate", null, null, null, null)))).emitsExactly(bar_2);
}
@Test
public void findsByExample_id()
{
- assertThat(repository.findAll(Example.of(new MessageTo(null, null, 1l, null, null, null)))).containsExactly(foo_1, bar_1);
- assertThat(repository.findAll(Example.of(new MessageTo(null, null, 2l, null, null, null)))).containsExactly(foo_2, bar_2);
- assertThat(repository.findAll(Example.of(new MessageTo(null, null, 3l, null, null, null)))).containsExactly(bar_3);
+ assertThat(repository.findAll(Example.of(new MessageTo(null, null, 1l, null, null, null)))).emitsExactly(foo_1, bar_1);
+ assertThat(repository.findAll(Example.of(new MessageTo(null, null, 2l, null, null, null)))).emitsExactly(foo_2, bar_2);
+ assertThat(repository.findAll(Example.of(new MessageTo(null, null, 3l, null, null, null)))).emitsExactly(bar_3);
}
}