SpringContextAssertions.java

1
package fr.sii.ogham.testing.assertion.internal.matcher;
2
3
import org.hamcrest.Matcher;
4
import org.springframework.context.ApplicationContext;
5
6
/**
7
 * Make assertions on Spring
8
 * 
9
 * @author Aurélien Baudet
10
 *
11
 */
12
public class SpringContextAssertions {
13
	/**
14
	 * Ensure that provided object is the same instance as the bean available in
15
	 * Spring context.
16
	 * 
17
	 * <p>
18
	 * If no bean is declared, then it will fail.
19
	 * 
20
	 * <p>
21
	 * If a bean is declared but not same instance, then it will fail.
22
	 * 
23
	 * 
24
	 * @param <T>
25
	 *            the type of the expected object
26
	 * @param context
27
	 *            the Spring context (used to retrieve bean instance)
28
	 * @param beanClass
29
	 *            the class of the bean to match
30
	 * @return the matcher
31
	 */
32
	public static <T> Matcher<T> isSpringBeanInstance(ApplicationContext context, Class<?> beanClass) {
33 3 1. isSpringBeanInstance : replaced return value with null for fr/sii/ogham/testing/assertion/internal/matcher/SpringContextAssertions::isSpringBeanInstance → NO_COVERAGE
2. isSpringBeanInstance : replaced return value with null for fr/sii/ogham/testing/assertion/internal/matcher/SpringContextAssertions::isSpringBeanInstance → TIMED_OUT
3. isSpringBeanInstance : replaced return value with null for fr/sii/ogham/testing/assertion/internal/matcher/SpringContextAssertions::isSpringBeanInstance → KILLED
		return new IsSpringBeanInstance<>(context, beanClass);
34
	}
35
36
	private SpringContextAssertions() {
37
		super();
38
	}
39
}

Mutations

33

1.1
Location : isSpringBeanInstance
Killed by : oghamspringbootv1autoconfigure.it.OghamSpringBoot1SendGridAutoConfigurationTests.oghamWithSendGridAutoConfigShouldUseSpringSendGridClient(oghamspringbootv1autoconfigure.it.OghamSpringBoot1SendGridAutoConfigurationTests)
replaced return value with null for fr/sii/ogham/testing/assertion/internal/matcher/SpringContextAssertions::isSpringBeanInstance → KILLED

2.2
Location : isSpringBeanInstance
Killed by : none
replaced return value with null for fr/sii/ogham/testing/assertion/internal/matcher/SpringContextAssertions::isSpringBeanInstance → NO_COVERAGE

3.3
Location : isSpringBeanInstance
Killed by : none
replaced return value with null for fr/sii/ogham/testing/assertion/internal/matcher/SpringContextAssertions::isSpringBeanInstance → TIMED_OUT

Active mutators

Tests examined


Report generated by PIT OGHAM