FileNamePredicate.java

1
package fr.sii.ogham.testing.assertion.filter;
2
3
import javax.mail.MessagingException;
4
import javax.mail.Part;
5
6
import com.google.common.base.Predicate;
7
8
/**
9
 * Predicate that matches the {@link Part} only if {@link Part#getFileName()}
10
 * exactly matches the provided filename.
11
 * 
12
 * @author Aurélien Baudet
13
 *
14
 */
15
public class FileNamePredicate implements Predicate<Part> {
16
	private final String filename;
17
18
	public FileNamePredicate(String filename) {
19
		super();
20
		this.filename = filename;
21
	}
22
23
	@Override
24
	public boolean apply(Part input) {
25
		try {
26 8 1. apply : replaced boolean return with false for fr/sii/ogham/testing/assertion/filter/FileNamePredicate::apply → NO_COVERAGE
2. apply : replaced boolean return with true for fr/sii/ogham/testing/assertion/filter/FileNamePredicate::apply → SURVIVED
3. apply : replaced boolean return with true for fr/sii/ogham/testing/assertion/filter/FileNamePredicate::apply → NO_COVERAGE
4. apply : replaced boolean return with false for fr/sii/ogham/testing/assertion/filter/FileNamePredicate::apply → KILLED
5. apply : replaced boolean return with false for fr/sii/ogham/testing/assertion/filter/FileNamePredicate::apply → KILLED
6. apply : replaced boolean return with false for fr/sii/ogham/testing/assertion/filter/FileNamePredicate::apply → KILLED
7. apply : replaced boolean return with true for fr/sii/ogham/testing/assertion/filter/FileNamePredicate::apply → KILLED
8. apply : replaced boolean return with true for fr/sii/ogham/testing/assertion/filter/FileNamePredicate::apply → KILLED
			return filename.equals(input.getFileName());
27
		} catch (MessagingException e) {
28
			throw new AssertionError("Failed to access message", e);
29
		}
30
	}
31
32
	@Override
33
	public String toString() {
34 3 1. toString : replaced return value with "" for fr/sii/ogham/testing/assertion/filter/FileNamePredicate::toString → SURVIVED
2. toString : replaced return value with "" for fr/sii/ogham/testing/assertion/filter/FileNamePredicate::toString → NO_COVERAGE
3. toString : replaced return value with "" for fr/sii/ogham/testing/assertion/filter/FileNamePredicate::toString → KILLED
		return "named '" + filename + "'";
35
	}
36
}

Mutations

26

1.1
Location : apply
Killed by : oghamall.it.email.EmailSMTPDefaultsTest.attachmentLookup(oghamall.it.email.EmailSMTPDefaultsTest)
replaced boolean return with false for fr/sii/ogham/testing/assertion/filter/FileNamePredicate::apply → KILLED

2.2
Location : apply
Killed by : none
replaced boolean return with false for fr/sii/ogham/testing/assertion/filter/FileNamePredicate::apply → NO_COVERAGE

3.3
Location : apply
Killed by : oghamjavamail.it.JavaMailSmtpTest.attachment(oghamjavamail.it.JavaMailSmtpTest)
replaced boolean return with false for fr/sii/ogham/testing/assertion/filter/FileNamePredicate::apply → KILLED

4.4
Location : apply
Killed by : oghamtesting.it.assertion.FluentEmailAssertionsSpec
replaced boolean return with false for fr/sii/ogham/testing/assertion/filter/FileNamePredicate::apply → KILLED

5.5
Location : apply
Killed by : none
replaced boolean return with true for fr/sii/ogham/testing/assertion/filter/FileNamePredicate::apply → SURVIVED

6.6
Location : apply
Killed by : none
replaced boolean return with true for fr/sii/ogham/testing/assertion/filter/FileNamePredicate::apply → NO_COVERAGE

7.7
Location : apply
Killed by : oghamtesting.it.assertion.FluentEmailAssertionsSpec
replaced boolean return with true for fr/sii/ogham/testing/assertion/filter/FileNamePredicate::apply → KILLED

8.8
Location : apply
Killed by : oghamall.it.resolver.FreemarkerRelativeResourcesTests.relativeToPrefixSuffixAndPath(oghamall.it.resolver.FreemarkerRelativeResourcesTests)
replaced boolean return with true for fr/sii/ogham/testing/assertion/filter/FileNamePredicate::apply → KILLED

34

1.1
Location : toString
Killed by : none
replaced return value with "" for fr/sii/ogham/testing/assertion/filter/FileNamePredicate::toString → SURVIVED

2.2
Location : toString
Killed by : oghamtesting.it.assertion.FluentEmailAssertionsSpec
replaced return value with "" for fr/sii/ogham/testing/assertion/filter/FileNamePredicate::toString → KILLED

3.3
Location : toString
Killed by : none
replaced return value with "" for fr/sii/ogham/testing/assertion/filter/FileNamePredicate::toString → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT OGHAM