.thenReturn(Mono.just(existingMessage));
// Needed for readable error-reports, in case of a bug that leads to according unwanted call
when(chatRoomService.persistMessage(any(Message.MessageKey.class), any(LocalDateTime.class), any(String.class)))
- .thenReturn(mock(Message.class));
+ .thenReturn(Mono.just(mock(Message.class)));
// When
client
.thenReturn(Mono.empty());
// Needed for readable error-reports, in case of a bug that leads to according unwanted call
when(chatRoomService.persistMessage(any(Message.MessageKey.class), any(LocalDateTime.class), any(String.class)))
- .thenReturn(mock(Message.class));
+ .thenReturn(Mono.just(mock(Message.class)));
// When
client
String messageText = "Bar";
Message message = new Message(key, 0l, timestamp, messageText);
when(chatRoomService.getMessage(any(Message.MessageKey.class))).thenReturn(Mono.empty());
- when(chatRoomService.persistMessage(any(Message.MessageKey.class), any(LocalDateTime.class), any(String.class))).thenReturn(message);
+ when(chatRoomService.persistMessage(any(Message.MessageKey.class), any(LocalDateTime.class), any(String.class))).thenReturn(Mono.just(message));
// When
Mono<Message> mono = chatRoom.addMessage(messageId, user, messageText);
String messageText = "Bar";
Message message = new Message(key, 0l, timestamp, messageText);
when(chatRoomService.getMessage(any(Message.MessageKey.class))).thenReturn(Mono.just(message));
- when(chatRoomService.persistMessage(any(Message.MessageKey.class), any(LocalDateTime.class), any(String.class))).thenReturn(message);
+ when(chatRoomService.persistMessage(any(Message.MessageKey.class), any(LocalDateTime.class), any(String.class))).thenReturn(Mono.just(message));
// When
Mono<Message> mono = chatRoom.addMessage(messageId, user, messageText);
String mutatedText = "Boom!";
Message message = new Message(key, 0l, timestamp, messageText);
when(chatRoomService.getMessage(any(Message.MessageKey.class))).thenReturn(Mono.just(message));
- when(chatRoomService.persistMessage(any(Message.MessageKey.class), any(LocalDateTime.class), any(String.class))).thenReturn(message);
+ when(chatRoomService.persistMessage(any(Message.MessageKey.class), any(LocalDateTime.class), any(String.class))).thenReturn(Mono.just(message));
// When
Mono<Message> mono = chatRoom.addMessage(messageId, user, mutatedText);