Clover icon

sunshower-base

  1. Project Clover database Fri Apr 6 2018 03:41:27 UTC
  2. Package io.sunshower.test.ws

File RESTContextCustomizerFactory.java

 

Coverage histogram

../../../../img/srcFileCovDistChart8.png
19% of files have more coverage

Code metrics

4
6
2
1
28
24
4
0.67
3
2
2

Classes

Class Line # Actions
RESTContextCustomizerFactory 9 6 4
0.7575%
 

Contributing tests

No tests hitting this source file were found.

Source view

1    package io.sunshower.test.ws;
2   
3    import java.util.List;
4    import org.springframework.lang.Nullable;
5    import org.springframework.test.context.ContextConfigurationAttributes;
6    import org.springframework.test.context.ContextCustomizer;
7    import org.springframework.test.context.ContextCustomizerFactory;
8   
 
9    public class RESTContextCustomizerFactory implements ContextCustomizerFactory {
10   
 
11  1 toggle @Nullable
12    @Override
13    public ContextCustomizer createContextCustomizer(
14    Class<?> testClass, List<ContextConfigurationAttributes> configAttributes) {
15  1 EnableJAXRS config = resolveConfig(testClass);
16  1 return new RESTConfigCustomizer(config);
17    }
18   
 
19  1 toggle EnableJAXRS resolveConfig(Class<?> type) {
20  1 for (Class<?> current = type; current != null; current = type.getSuperclass()) {
21  1 if (type.isAnnotationPresent(EnableJAXRS.class)) {
22  1 return type.getAnnotation(EnableJAXRS.class);
23    }
24    }
25  0 throw new IllegalStateException(
26    String.format("No @EnableJAXRS found in class hierarchy (class: %s)", type));
27    }
28    }