|
14 | 14 | * limitations under the License.
|
15 | 15 | */
|
16 | 16 | package org.springframework.data.jdbc.degraph;
|
17 |
| -import static de.schauderhaft.degraph.check.JCheck.classpath; |
18 |
| -import static org.junit.Assert.assertThat; |
19 | 17 |
|
20 |
| -import org.junit.Test; |
| 18 | +import static de.schauderhaft.degraph.check.JCheck.*; |
| 19 | +import static org.junit.Assert.*; |
21 | 20 |
|
22 | 21 | import de.schauderhaft.degraph.check.JCheck;
|
| 22 | +import scala.runtime.AbstractFunction1; |
| 23 | + |
| 24 | +import org.junit.Test; |
23 | 25 |
|
24 | 26 | /**
|
| 27 | + * Test package dependencies for violations. |
| 28 | + * |
25 | 29 | * @author Jens Schauder
|
26 | 30 | */
|
27 | 31 | public class DependencyTests {
|
28 | 32 |
|
29 |
| - @Test public void test() { |
30 |
| - assertThat( classpath() |
31 |
| - .noJars() |
32 |
| - .including("org.springframework.data.jdbc.**") |
33 |
| - .filterClasspath("*target/classes") |
34 |
| - .printOnFailure("degraph.graphml"), JCheck.violationFree()); |
| 33 | + @Test // DATAJDBC-114 |
| 34 | + public void cycleFree() { |
35 | 35 |
|
| 36 | + assertThat( // |
| 37 | + classpath() // |
| 38 | + .noJars() // |
| 39 | + .including("org.springframework.data.jdbc.**") // |
| 40 | + .filterClasspath("*target/classes") // exclude test code |
| 41 | + .printOnFailure("degraph.graphml"), |
| 42 | + JCheck.violationFree()); |
36 | 43 | }
|
37 | 44 |
|
| 45 | + @Test // DATAJDBC-220 |
| 46 | + public void acrossModules() { |
| 47 | + |
| 48 | + assertThat( // |
| 49 | + classpath() // |
| 50 | + // include only Spring Data related classes (for example no JDK code) |
| 51 | + .including("org.springframework.data.**") // |
| 52 | + .filterClasspath(new AbstractFunction1<String, Object>() { |
| 53 | + @Override |
| 54 | + public Object apply(String s) { // |
| 55 | + // only the current module + commons |
| 56 | + return s.endsWith("target/classes") || s.contains("spring-data-commons"); |
| 57 | + } |
| 58 | + }) // exclude test code |
| 59 | + .withSlicing("sub-modules", // sub-modules are defined by any of the following pattern. |
| 60 | + "org.springframework.data.jdbc.(**).*", // |
| 61 | + "org.springframework.data.(**).*") // |
| 62 | + .printTo("degraph-across-modules.graphml"), // writes a graphml to this location |
| 63 | + JCheck.violationFree()); |
| 64 | + } |
38 | 65 | }
|
0 commit comments