forked from examplehub/Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStaticSenderFactoryTest.java
More file actions
47 lines (39 loc) · 1.3 KB
/
StaticSenderFactoryTest.java
File metadata and controls
47 lines (39 loc) · 1.3 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package com.examplehub.designpatterns.factory;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;
class StaticSenderFactoryTest {
@Test
void testBuildEmailSender() {
Sender sender = StaticSenderFactory.build("email");
assert sender != null;
assertEquals("email:how are you", sender.send("how are you"));
}
@Test
void testBuildSmsSender() {
Sender sender = StaticSenderFactory.build("sms");
assert sender != null;
assertEquals("sms:you are so beautiful", sender.send("you are so beautiful"));
}
@Test
void testBuildEmailSenderEnum() {
Sender sender = StaticSenderFactory.build(SenderType.EMAIL_SENDER);
assert sender != null;
assertEquals("email:how are you", sender.send("how are you"));
}
@Test
void testBuildSmsSenderEnum() {
Sender sender = StaticSenderFactory.build(SenderType.SMS_SENDER);
assert sender != null;
assertEquals("sms:how are you", sender.send("how are you"));
}
@Test
void testBuildEmailType() {
Sender sender = StaticSenderFactory.buildEmailSender();
assertEquals("email:how are you", sender.send("how are you"));
}
@Test
void testBuildSmsType() {
Sender sender = StaticSenderFactory.buildSmsSender();
assertEquals("sms:how are you", sender.send("how are you"));
}
}