|
@@ -26,6 +26,15 @@ internal class IrcClientConfigBuilderTest {
|
26
|
26
|
}
|
27
|
27
|
}
|
28
|
28
|
|
|
29
|
+ @Test
|
|
30
|
+ fun `throws if empty host is provided`() {
|
|
31
|
+ assertThrows<IllegalStateException> {
|
|
32
|
+ IrcClientConfigBuilder().apply {
|
|
33
|
+ server("")
|
|
34
|
+ }
|
|
35
|
+ }
|
|
36
|
+ }
|
|
37
|
+
|
29
|
38
|
@Test
|
30
|
39
|
fun `throws if profile is defined twice`() {
|
31
|
40
|
assertThrows<IllegalStateException> {
|
|
@@ -45,6 +54,15 @@ internal class IrcClientConfigBuilderTest {
|
45
|
54
|
}
|
46
|
55
|
}
|
47
|
56
|
|
|
57
|
+ @Test
|
|
58
|
+ fun `throws if empty nickname is provided`() {
|
|
59
|
+ assertThrows<IllegalStateException> {
|
|
60
|
+ IrcClientConfigBuilder().apply {
|
|
61
|
+ profile("")
|
|
62
|
+ }
|
|
63
|
+ }
|
|
64
|
+ }
|
|
65
|
+
|
48
|
66
|
@Test
|
49
|
67
|
fun `throws if sasl is defined twice`() {
|
50
|
68
|
assertThrows<IllegalStateException> {
|
|
@@ -91,6 +109,35 @@ internal class IrcClientConfigBuilderTest {
|
91
|
109
|
assertTrue(config.server.useTls)
|
92
|
110
|
}
|
93
|
111
|
|
|
112
|
+ @Test
|
|
113
|
+ fun `applies server settings with convenience function`() {
|
|
114
|
+ val config = IrcClientConfigBuilder().apply {
|
|
115
|
+ profile { nickname = "acidBurn" }
|
|
116
|
+ server("thegibson.com", 1337, true, "h4cktheplan3t")
|
|
117
|
+ }.build()
|
|
118
|
+
|
|
119
|
+ assertEquals("thegibson.com", config.server.host)
|
|
120
|
+ assertEquals(1337, config.server.port)
|
|
121
|
+ assertEquals("h4cktheplan3t", config.server.password)
|
|
122
|
+ assertTrue(config.server.useTls)
|
|
123
|
+ }
|
|
124
|
+
|
|
125
|
+ @Test
|
|
126
|
+ fun `applies server settings with convenience function and block`() {
|
|
127
|
+ val config = IrcClientConfigBuilder().apply {
|
|
128
|
+ profile { nickname = "acidBurn" }
|
|
129
|
+ server("thegibson.com", 1337) {
|
|
130
|
+ password = "h4cktheplan3t"
|
|
131
|
+ useTls = true
|
|
132
|
+ }
|
|
133
|
+ }.build()
|
|
134
|
+
|
|
135
|
+ assertEquals("thegibson.com", config.server.host)
|
|
136
|
+ assertEquals(1337, config.server.port)
|
|
137
|
+ assertEquals("h4cktheplan3t", config.server.password)
|
|
138
|
+ assertTrue(config.server.useTls)
|
|
139
|
+ }
|
|
140
|
+
|
94
|
141
|
@Test
|
95
|
142
|
fun `applies profile settings`() {
|
96
|
143
|
val config = IrcClientConfigBuilder().apply {
|
|
@@ -107,6 +154,32 @@ internal class IrcClientConfigBuilderTest {
|
107
|
154
|
assertEquals("Kate", config.profile.realName)
|
108
|
155
|
}
|
109
|
156
|
|
|
157
|
+ @Test
|
|
158
|
+ fun `applies profile settings with convenience function`() {
|
|
159
|
+ val config = IrcClientConfigBuilder().apply {
|
|
160
|
+ profile("acidBurn", "acidB", "Kate")
|
|
161
|
+ server { host = "thegibson.com" }
|
|
162
|
+ }.build()
|
|
163
|
+
|
|
164
|
+ assertEquals("acidBurn", config.profile.nickname)
|
|
165
|
+ assertEquals("acidB", config.profile.username)
|
|
166
|
+ assertEquals("Kate", config.profile.realName)
|
|
167
|
+ }
|
|
168
|
+
|
|
169
|
+ @Test
|
|
170
|
+ fun `applies profile settings with convenience function and block`() {
|
|
171
|
+ val config = IrcClientConfigBuilder().apply {
|
|
172
|
+ profile("acidBurn", "acidB") {
|
|
173
|
+ realName = "Kate"
|
|
174
|
+ }
|
|
175
|
+ server { host = "thegibson.com" }
|
|
176
|
+ }.build()
|
|
177
|
+
|
|
178
|
+ assertEquals("acidBurn", config.profile.nickname)
|
|
179
|
+ assertEquals("acidB", config.profile.username)
|
|
180
|
+ assertEquals("Kate", config.profile.realName)
|
|
181
|
+ }
|
|
182
|
+
|
110
|
183
|
@Test
|
111
|
184
|
fun `applies sasl settings`() {
|
112
|
185
|
val config = IrcClientConfigBuilder().apply {
|