1 | package fr.sii.ogham.testing.assertion.email; | |
2 | ||
3 | import java.util.ArrayList; | |
4 | import java.util.Arrays; | |
5 | import java.util.List; | |
6 | ||
7 | /** | |
8 | * Class used in tests for ensuring that the email is respected. It provides the | |
9 | * following information: | |
10 | * <ul> | |
11 | * <li>The expected subject</li> | |
12 | * <li>The expected sender address</li> | |
13 | * <li>The expected recipients (to, cc, bcc)</li> | |
14 | * </ul> | |
15 | * | |
16 | * @author Aurélien Baudet | |
17 | * | |
18 | */ | |
19 | public class ExpectedEmailHeader { | |
20 | /** | |
21 | * The expected subject | |
22 | */ | |
23 | protected String subject; | |
24 | | |
25 | /** | |
26 | * The expected sender address | |
27 | */ | |
28 | protected String from; | |
29 | | |
30 | /** | |
31 | * The expected list of recipients for the "to" field | |
32 | */ | |
33 | protected List<String> to = new ArrayList<>(); | |
34 | ||
35 | /** | |
36 | * The expected list of recipients for the "cc" field | |
37 | */ | |
38 | protected List<String> cc = new ArrayList<>(); | |
39 | ||
40 | /** | |
41 | * The expected list of recipients for the "bcc" field | |
42 | */ | |
43 | protected List<String> bcc = new ArrayList<>(); | |
44 | ||
45 | public ExpectedEmailHeader(String subject, String from, String... to) { | |
46 | this(subject, from, new ArrayList<>(Arrays.asList(to))); | |
47 | } | |
48 | ||
49 | public ExpectedEmailHeader(String subject, String from, List<String> to) { | |
50 | super(); | |
51 | this.subject = subject; | |
52 | this.from = from; | |
53 | this.to = to; | |
54 | } | |
55 | ||
56 | public String getSubject() { | |
57 |
2
1. getSubject : replaced return value with "" for fr/sii/ogham/testing/assertion/email/ExpectedEmailHeader::getSubject → NO_COVERAGE 2. getSubject : replaced return value with "" for fr/sii/ogham/testing/assertion/email/ExpectedEmailHeader::getSubject → KILLED |
return subject; |
58 | } | |
59 | ||
60 | public String getFrom() { | |
61 |
2
1. getFrom : replaced return value with "" for fr/sii/ogham/testing/assertion/email/ExpectedEmailHeader::getFrom → NO_COVERAGE 2. getFrom : replaced return value with "" for fr/sii/ogham/testing/assertion/email/ExpectedEmailHeader::getFrom → KILLED |
return from; |
62 | } | |
63 | ||
64 | public List<String> getTo() { | |
65 |
2
1. getTo : replaced return value with Collections.emptyList for fr/sii/ogham/testing/assertion/email/ExpectedEmailHeader::getTo → NO_COVERAGE 2. getTo : replaced return value with Collections.emptyList for fr/sii/ogham/testing/assertion/email/ExpectedEmailHeader::getTo → KILLED |
return to; |
66 | } | |
67 | ||
68 | public List<String> getCc() { | |
69 |
2
1. getCc : replaced return value with Collections.emptyList for fr/sii/ogham/testing/assertion/email/ExpectedEmailHeader::getCc → NO_COVERAGE 2. getCc : replaced return value with Collections.emptyList for fr/sii/ogham/testing/assertion/email/ExpectedEmailHeader::getCc → KILLED |
return cc; |
70 | } | |
71 | ||
72 | public List<String> getBcc() { | |
73 |
2
1. getBcc : replaced return value with Collections.emptyList for fr/sii/ogham/testing/assertion/email/ExpectedEmailHeader::getBcc → NO_COVERAGE 2. getBcc : replaced return value with Collections.emptyList for fr/sii/ogham/testing/assertion/email/ExpectedEmailHeader::getBcc → KILLED |
return bcc; |
74 | } | |
75 | ||
76 | public void setCc(String... cc) { | |
77 | this.cc = new ArrayList<>(Arrays.asList(cc)); | |
78 | } | |
79 | ||
80 | public void setBcc(String... bcc) { | |
81 | this.bcc = new ArrayList<>(Arrays.asList(bcc)); | |
82 | } | |
83 | } | |
Mutations | ||
57 |
1.1 2.2 |
|
61 |
1.1 2.2 |
|
65 |
1.1 2.2 |
|
69 |
1.1 2.2 |
|
73 |
1.1 2.2 |