1 | package fr.sii.ogham.testing.assertion.internal; | |
2 | ||
3 | import static fr.sii.ogham.testing.assertion.internal.CloudhopperAssertions.getCloudhopperSender; | |
4 | import static fr.sii.ogham.testing.assertion.internal.FreemarkerAssersions.getFreemarkerParsers; | |
5 | import static fr.sii.ogham.testing.assertion.internal.JavaMailAssertions.getJavaMailSender; | |
6 | import static fr.sii.ogham.testing.assertion.internal.SendGridAssertions.getSendGridSender; | |
7 | import static fr.sii.ogham.testing.assertion.internal.ThymeleafAssertions.getThymeleafParsers; | |
8 | ||
9 | import fr.sii.ogham.core.builder.MessagingBuilder; | |
10 | import fr.sii.ogham.core.service.MessagingService; | |
11 | ||
12 | /** | |
13 | * Helper to make assertions on {@link MessagingService} instance created by a | |
14 | * {@link MessagingBuilder}. | |
15 | * | |
16 | * @author Aurélien Baudet | |
17 | * | |
18 | */ | |
19 | public class MessagingServiceAssertions { | |
20 | private final MessagingService messagingService; | |
21 | ||
22 | public MessagingServiceAssertions(MessagingService messagingService) { | |
23 | this.messagingService = messagingService; | |
24 | } | |
25 | ||
26 | /** | |
27 | * Use it to ensure that SendGrid is configured as expected. | |
28 | * | |
29 | * <p> | |
30 | * The version of SendGrid is automatically determined. If the automatic | |
31 | * detection doesn't work, use {@link #sendGrid(SendGridVersion)} | |
32 | * | |
33 | * For example: | |
34 | * | |
35 | * <pre> | |
36 | * {@code | |
37 | * sendGrid() | |
38 | * .apiKey(equalTo("foo")) | |
39 | * } | |
40 | * </pre> | |
41 | * | |
42 | * @return builder for fluent chaining | |
43 | */ | |
44 | public SendGridAssertions sendGrid() { | |
45 |
4
1. sendGrid : replaced return value with null for fr/sii/ogham/testing/assertion/internal/MessagingServiceAssertions::sendGrid → NO_COVERAGE 2. sendGrid : replaced return value with null for fr/sii/ogham/testing/assertion/internal/MessagingServiceAssertions::sendGrid → KILLED 3. sendGrid : replaced return value with null for fr/sii/ogham/testing/assertion/internal/MessagingServiceAssertions::sendGrid → KILLED 4. sendGrid : replaced return value with null for fr/sii/ogham/testing/assertion/internal/MessagingServiceAssertions::sendGrid → KILLED |
return new SendGridAssertions(this, getSendGridSender(messagingService)); |
46 | } | |
47 | ||
48 | /** | |
49 | * Use it to ensure that SendGrid (for a particular version) is configured | |
50 | * as expected. | |
51 | * | |
52 | * For example: | |
53 | * | |
54 | * <pre> | |
55 | * {code | |
56 | * sendGrid(SendGridVersion.V2) | |
57 | * .apiKey(equalTo("foo")) | |
58 | * } | |
59 | * </pre> | |
60 | * | |
61 | * @param sendGridVersion | |
62 | * the SendGrid version to use | |
63 | * @return builder for fluent chaining | |
64 | */ | |
65 | public SendGridAssertions sendGrid(SendGridVersion sendGridVersion) { | |
66 |
1
1. sendGrid : replaced return value with null for fr/sii/ogham/testing/assertion/internal/MessagingServiceAssertions::sendGrid → NO_COVERAGE |
return new SendGridAssertions(this, getSendGridSender(messagingService, sendGridVersion.getSenderClass())); |
67 | } | |
68 | ||
69 | /** | |
70 | * Use it to ensure that Thymeleaf is configured as expected. | |
71 | * | |
72 | * <p> | |
73 | * All the ThymeleafParser instances are automatically retrieved | |
74 | * from {@link MessagingService}. You can then select which | |
75 | * ThymeleafParser to check by using fluent API. | |
76 | * | |
77 | * For example: | |
78 | * | |
79 | * <pre> | |
80 | * {@code | |
81 | * thymeleaf() | |
82 | * .email() | |
83 | * .engine(isA(SpringTemplateEngine.class)) | |
84 | * } | |
85 | * </pre> | |
86 | * | |
87 | * @return the builder for fluent chaining | |
88 | */ | |
89 | public ThymeleafAssertions thymeleaf() { | |
90 |
4
1. thymeleaf : replaced return value with null for fr/sii/ogham/testing/assertion/internal/MessagingServiceAssertions::thymeleaf → NO_COVERAGE 2. thymeleaf : replaced return value with null for fr/sii/ogham/testing/assertion/internal/MessagingServiceAssertions::thymeleaf → KILLED 3. thymeleaf : replaced return value with null for fr/sii/ogham/testing/assertion/internal/MessagingServiceAssertions::thymeleaf → KILLED 4. thymeleaf : replaced return value with null for fr/sii/ogham/testing/assertion/internal/MessagingServiceAssertions::thymeleaf → KILLED |
return new ThymeleafAssertions(this, getThymeleafParsers(messagingService)); |
91 | } | |
92 | ||
93 | /** | |
94 | * Use it to ensure that FreeMarker is configured as expected. | |
95 | * | |
96 | * <p> | |
97 | * All the FreeMarkerParser instances are automatically retrieved | |
98 | * from {@link MessagingService}. You can then select which | |
99 | * FreeMarkerParser to check by using fluent API. | |
100 | * | |
101 | * For example, to ensure that UTF-8 is used as default encoding for email | |
102 | * parser: | |
103 | * | |
104 | * <pre> | |
105 | * {@code | |
106 | * freemarker() | |
107 | * .email() | |
108 | * .configuration() | |
109 | * .defaultEncoding(equalTo("UTF-8")) | |
110 | * } | |
111 | * </pre> | |
112 | * | |
113 | * @return the builder for fluent chaining | |
114 | */ | |
115 | public FreemarkerAssersions freemarker() { | |
116 |
4
1. freemarker : replaced return value with null for fr/sii/ogham/testing/assertion/internal/MessagingServiceAssertions::freemarker → NO_COVERAGE 2. freemarker : replaced return value with null for fr/sii/ogham/testing/assertion/internal/MessagingServiceAssertions::freemarker → KILLED 3. freemarker : replaced return value with null for fr/sii/ogham/testing/assertion/internal/MessagingServiceAssertions::freemarker → KILLED 4. freemarker : replaced return value with null for fr/sii/ogham/testing/assertion/internal/MessagingServiceAssertions::freemarker → KILLED |
return new FreemarkerAssersions(this, getFreemarkerParsers(messagingService)); |
117 | } | |
118 | ||
119 | /** | |
120 | * Use it to ensure that JavaMailSender is configured as expected. | |
121 | * | |
122 | * For example: | |
123 | * | |
124 | * <pre> | |
125 | * {@code | |
126 | * javaMail() | |
127 | * .host(equalTo("foo")) | |
128 | * } | |
129 | * </pre> | |
130 | * | |
131 | * @return the builder for fluent chaining | |
132 | */ | |
133 | public JavaMailAssertions javaMail() { | |
134 |
4
1. javaMail : replaced return value with null for fr/sii/ogham/testing/assertion/internal/MessagingServiceAssertions::javaMail → NO_COVERAGE 2. javaMail : replaced return value with null for fr/sii/ogham/testing/assertion/internal/MessagingServiceAssertions::javaMail → KILLED 3. javaMail : replaced return value with null for fr/sii/ogham/testing/assertion/internal/MessagingServiceAssertions::javaMail → KILLED 4. javaMail : replaced return value with null for fr/sii/ogham/testing/assertion/internal/MessagingServiceAssertions::javaMail → KILLED |
return new JavaMailAssertions(this, getJavaMailSender(messagingService)); |
135 | } | |
136 | ||
137 | /** | |
138 | * Use it to ensure that CloudhopperSMPPSender is configured as expected. | |
139 | * | |
140 | * For example: | |
141 | * | |
142 | * <pre> | |
143 | * {@code | |
144 | * cloudhopper() | |
145 | * .host(equalTo("foo")) | |
146 | * } | |
147 | * </pre> | |
148 | * | |
149 | * @return the builder for fluent chaining | |
150 | */ | |
151 | public CloudhopperAssertions cloudhopper() { | |
152 |
3
1. cloudhopper : replaced return value with null for fr/sii/ogham/testing/assertion/internal/MessagingServiceAssertions::cloudhopper → NO_COVERAGE 2. cloudhopper : replaced return value with null for fr/sii/ogham/testing/assertion/internal/MessagingServiceAssertions::cloudhopper → KILLED 3. cloudhopper : replaced return value with null for fr/sii/ogham/testing/assertion/internal/MessagingServiceAssertions::cloudhopper → KILLED |
return new CloudhopperAssertions(this, getCloudhopperSender(messagingService)); |
153 | } | |
154 | ||
155 | } | |
Mutations | ||
45 |
1.1 2.2 3.3 4.4 |
|
66 |
1.1 |
|
90 |
1.1 2.2 3.3 4.4 |
|
116 |
1.1 2.2 3.3 4.4 |
|
134 |
1.1 2.2 3.3 4.4 |
|
152 |
1.1 2.2 3.3 |