-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBotTest.java
29 lines (24 loc) · 1.04 KB
/
BotTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import com.isageek.blaztek.bot.Bot;
import com.isageek.blaztek.bot.MessageNotParsedException;
import com.isageek.blaztek.bot.NaughtyWordException;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
@DisplayName("Bot Test")
public class BotTest {
@Test
void mrRoboto() {
Bot bot = new Bot();
String message = " How are you ? ";
Assertions.assertDoesNotThrow(() -> {
String parsedMessage = bot.parseInput(message);
Assertions.assertEquals("how are you", parsedMessage);
Assertions.assertDoesNotThrow(() -> bot.chat(parsedMessage));
String pm = bot.parseInput("Who do you love?");
Assertions.assertEquals("who do you love", pm);
Assertions.assertDoesNotThrow(() -> bot.chat(pm));
});
Assertions.assertThrows(NaughtyWordException.class, () -> bot.parseInput("WTF?"));
Assertions.assertThrows(MessageNotParsedException.class, () -> bot.chat("not parsed"));
}
}