CorrectPackageNameMailCompat.java

1
package fr.sii.ogham.email.sendgrid.v4.sender.impl.sendgrid.compat;
2
3
import static java.util.stream.Collectors.toList;
4
5
import java.io.IOException;
6
import java.util.List;
7
8
import com.sendgrid.helpers.mail.Mail;
9
import com.sendgrid.helpers.mail.objects.Content;
10
import com.sendgrid.helpers.mail.objects.Email;
11
import com.sendgrid.helpers.mail.objects.Personalization;
12
13
14
/**
15
 * Compatibility wrapper that wraps {@link Mail} instance and delegates
16
 * operations to it.
17
 * 
18
 * @author Aurélien Baudet
19
 * @see CompatUtil
20
 * @see CompatFactory
21
 */
22
public class CorrectPackageNameMailCompat implements MailCompat {
23
	private final Mail delegate;
24
25
	public CorrectPackageNameMailCompat() {
26
		this(new Mail());
27
	}
28
29
	public CorrectPackageNameMailCompat(Mail delegate) {
30
		super();
31
		this.delegate = delegate;
32
	}
33
34
	@Override
35
	public EmailCompat getFrom() {
36
		Email from = delegate.getFrom();
37 2 1. getFrom : negated conditional → NO_COVERAGE
2. getFrom : negated conditional → SURVIVED
		if (from == null) {
38
			return null;
39
		}
40 2 1. getFrom : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/sender/impl/sendgrid/compat/CorrectPackageNameMailCompat::getFrom → NO_COVERAGE
2. getFrom : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/sender/impl/sendgrid/compat/CorrectPackageNameMailCompat::getFrom → SURVIVED
		return new CorrectPackageNameEmailCompat(from);
41
	}
42
43
	@Override
44
	public String getSubject() {
45 2 1. getSubject : replaced return value with "" for fr/sii/ogham/email/sendgrid/v4/sender/impl/sendgrid/compat/CorrectPackageNameMailCompat::getSubject → NO_COVERAGE
2. getSubject : replaced return value with "" for fr/sii/ogham/email/sendgrid/v4/sender/impl/sendgrid/compat/CorrectPackageNameMailCompat::getSubject → SURVIVED
		return delegate.getSubject();
46
	}
47
48
	@Override
49
	public List<PersonalizationCompat> getPersonalization() {
50
		List<Personalization> personalization = delegate.getPersonalization();
51 2 1. getPersonalization : negated conditional → NO_COVERAGE
2. getPersonalization : negated conditional → KILLED
		if (personalization == null) {
52 2 1. getPersonalization : replaced return value with Collections.emptyList for fr/sii/ogham/email/sendgrid/v4/sender/impl/sendgrid/compat/CorrectPackageNameMailCompat::getPersonalization → NO_COVERAGE
2. getPersonalization : replaced return value with Collections.emptyList for fr/sii/ogham/email/sendgrid/v4/sender/impl/sendgrid/compat/CorrectPackageNameMailCompat::getPersonalization → SURVIVED
			return null;
53
		}
54 2 1. getPersonalization : replaced return value with Collections.emptyList for fr/sii/ogham/email/sendgrid/v4/sender/impl/sendgrid/compat/CorrectPackageNameMailCompat::getPersonalization → NO_COVERAGE
2. getPersonalization : replaced return value with Collections.emptyList for fr/sii/ogham/email/sendgrid/v4/sender/impl/sendgrid/compat/CorrectPackageNameMailCompat::getPersonalization → SURVIVED
		return personalization.stream()
55
				.map(CorrectPackageNamePersonalizationCompat::new)
56
				.collect(toList());
57
	}
58
59
	@Override
60
	public void setSubject(String subject) {
61 2 1. setSubject : removed call to com/sendgrid/helpers/mail/Mail::setSubject → NO_COVERAGE
2. setSubject : removed call to com/sendgrid/helpers/mail/Mail::setSubject → KILLED
		delegate.setSubject(subject);
62
	}
63
64
	@Override
65
	public void setFrom(String address, String personal) {
66 2 1. setFrom : removed call to com/sendgrid/helpers/mail/Mail::setFrom → NO_COVERAGE
2. setFrom : removed call to com/sendgrid/helpers/mail/Mail::setFrom → KILLED
		delegate.setFrom(new Email(address, personal));
67
	}
68
69
	@Override
70
	public void addContent(String mime, String contentStr) {
71 2 1. addContent : removed call to com/sendgrid/helpers/mail/Mail::addContent → NO_COVERAGE
2. addContent : removed call to com/sendgrid/helpers/mail/Mail::addContent → KILLED
		delegate.addContent(new Content(mime, contentStr));
72
	}
73
74
	@Override
75
	public void addPersonalization(PersonalizationCompat personalization) {
76 2 1. addPersonalization : removed call to com/sendgrid/helpers/mail/Mail::addPersonalization → NO_COVERAGE
2. addPersonalization : removed call to com/sendgrid/helpers/mail/Mail::addPersonalization → KILLED
		delegate.addPersonalization(((CorrectPackageNamePersonalizationCompat) personalization).getDelegate());
77
	}
78
79
	@Override
80
	public void addAttachments(AttachmentsCompat attachment) {
81 2 1. addAttachments : removed call to com/sendgrid/helpers/mail/Mail::addAttachments → NO_COVERAGE
2. addAttachments : removed call to com/sendgrid/helpers/mail/Mail::addAttachments → KILLED
		delegate.addAttachments(((CorrectPackageNameAttachmentsCompat) attachment).getDelegate());
82
	}
83
84
	@Override
85
	public String build() throws IOException {
86 2 1. build : replaced return value with "" for fr/sii/ogham/email/sendgrid/v4/sender/impl/sendgrid/compat/CorrectPackageNameMailCompat::build → NO_COVERAGE
2. build : replaced return value with "" for fr/sii/ogham/email/sendgrid/v4/sender/impl/sendgrid/compat/CorrectPackageNameMailCompat::build → KILLED
		return delegate.build();
87
	}
88
89
	@SuppressWarnings("unchecked")
90
	@Override
91
	public <M> M getDelegate() {
92 2 1. getDelegate : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/sender/impl/sendgrid/compat/CorrectPackageNameMailCompat::getDelegate → NO_COVERAGE
2. getDelegate : replaced return value with null for fr/sii/ogham/email/sendgrid/v4/sender/impl/sendgrid/compat/CorrectPackageNameMailCompat::getDelegate → KILLED
		return (M) delegate;
93
	}
94
}

Mutations

37

1.1
Location : getFrom
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : getFrom
Killed by : none
negated conditional → SURVIVED

40

1.1
Location : getFrom
Killed by : none
replaced return value with null for fr/sii/ogham/email/sendgrid/v4/sender/impl/sendgrid/compat/CorrectPackageNameMailCompat::getFrom → NO_COVERAGE

2.2
Location : getFrom
Killed by : none
replaced return value with null for fr/sii/ogham/email/sendgrid/v4/sender/impl/sendgrid/compat/CorrectPackageNameMailCompat::getFrom → SURVIVED

45

1.1
Location : getSubject
Killed by : none
replaced return value with "" for fr/sii/ogham/email/sendgrid/v4/sender/impl/sendgrid/compat/CorrectPackageNameMailCompat::getSubject → NO_COVERAGE

2.2
Location : getSubject
Killed by : none
replaced return value with "" for fr/sii/ogham/email/sendgrid/v4/sender/impl/sendgrid/compat/CorrectPackageNameMailCompat::getSubject → SURVIVED

51

1.1
Location : getPersonalization
Killed by : oghamsendgridv4.ut.SendGridClientTest.send_errorResponse
negated conditional → KILLED

2.2
Location : getPersonalization
Killed by : none
negated conditional → NO_COVERAGE

52

1.1
Location : getPersonalization
Killed by : none
replaced return value with Collections.emptyList for fr/sii/ogham/email/sendgrid/v4/sender/impl/sendgrid/compat/CorrectPackageNameMailCompat::getPersonalization → NO_COVERAGE

2.2
Location : getPersonalization
Killed by : none
replaced return value with Collections.emptyList for fr/sii/ogham/email/sendgrid/v4/sender/impl/sendgrid/compat/CorrectPackageNameMailCompat::getPersonalization → SURVIVED

54

1.1
Location : getPersonalization
Killed by : none
replaced return value with Collections.emptyList for fr/sii/ogham/email/sendgrid/v4/sender/impl/sendgrid/compat/CorrectPackageNameMailCompat::getPersonalization → NO_COVERAGE

2.2
Location : getPersonalization
Killed by : none
replaced return value with Collections.emptyList for fr/sii/ogham/email/sendgrid/v4/sender/impl/sendgrid/compat/CorrectPackageNameMailCompat::getPersonalization → SURVIVED

61

1.1
Location : setSubject
Killed by : oghamsendgridv4.it.SendGridTranslationTest.forBasicTextEmail
removed call to com/sendgrid/helpers/mail/Mail::setSubject → KILLED

2.2
Location : setSubject
Killed by : none
removed call to com/sendgrid/helpers/mail/Mail::setSubject → NO_COVERAGE

66

1.1
Location : setFrom
Killed by : none
removed call to com/sendgrid/helpers/mail/Mail::setFrom → NO_COVERAGE

2.2
Location : setFrom
Killed by : oghamsendgridv4.it.SendGridTranslationTest.forBasicTextEmail
removed call to com/sendgrid/helpers/mail/Mail::setFrom → KILLED

71

1.1
Location : addContent
Killed by : oghamsendgridv4.ut.StringContentHandlerTest.setContent_text
removed call to com/sendgrid/helpers/mail/Mail::addContent → KILLED

2.2
Location : addContent
Killed by : none
removed call to com/sendgrid/helpers/mail/Mail::addContent → NO_COVERAGE

76

1.1
Location : addPersonalization
Killed by : none
removed call to com/sendgrid/helpers/mail/Mail::addPersonalization → NO_COVERAGE

2.2
Location : addPersonalization
Killed by : oghamsendgridv4.it.SendGridTranslationTest.forBasicTextEmail
removed call to com/sendgrid/helpers/mail/Mail::addPersonalization → KILLED

81

1.1
Location : addAttachments
Killed by : none
removed call to com/sendgrid/helpers/mail/Mail::addAttachments → NO_COVERAGE

2.2
Location : addAttachments
Killed by : oghamsendgridv4.it.SendGridFluentEmailTest.attachResource()
removed call to com/sendgrid/helpers/mail/Mail::addAttachments → KILLED

86

1.1
Location : build
Killed by : none
replaced return value with "" for fr/sii/ogham/email/sendgrid/v4/sender/impl/sendgrid/compat/CorrectPackageNameMailCompat::build → NO_COVERAGE

2.2
Location : build
Killed by : oghamsendgridv4.it.SendGridFluentEmailTest.bodyString()
replaced return value with "" for fr/sii/ogham/email/sendgrid/v4/sender/impl/sendgrid/compat/CorrectPackageNameMailCompat::build → KILLED

92

1.1
Location : getDelegate
Killed by : none
replaced return value with null for fr/sii/ogham/email/sendgrid/v4/sender/impl/sendgrid/compat/CorrectPackageNameMailCompat::getDelegate → NO_COVERAGE

2.2
Location : getDelegate
Killed by : oghamsendgridv4.it.SendGridTranslationTest.forBasicTextEmail
replaced return value with null for fr/sii/ogham/email/sendgrid/v4/sender/impl/sendgrid/compat/CorrectPackageNameMailCompat::getDelegate → KILLED

Active mutators

Tests examined


Report generated by PIT OGHAM