@@ -72,8 +72,8 @@ public void execute_checkNotNecessary_ClassesDirNotFound() throws Exception {
7272 rule .execute (helper );
7373 List <String > infoLogs = helper .getLogMock ().getInfo ();
7474 assertThat (infoLogs , hasSize (3 ));
75- assertThat (infoLogs .get (0 ), is ("Directory " + nonExistentClassesFolder .getAbsolutePath () + " could not be found." ));
76- assertThat (infoLogs .get (1 ), is ("Directory " + nonExistentTestClassesFolder .getAbsolutePath () + " could not be found." ));
75+ assertThat (infoLogs .get (0 ), is ("Directory " + nonExistentClassesFolder .getAbsolutePath () + " could not be found." ));
76+ assertThat (infoLogs .get (1 ), is ("Directory " + nonExistentTestClassesFolder .getAbsolutePath () + " could not be found." ));
7777 assertThat (infoLogs .get (2 ), is ("No directories with classes to check for cycles found." ));
7878 }
7979
@@ -98,8 +98,17 @@ public void execute_ContainsNoCycles() throws Exception {
9898 rule .execute (helper );
9999 List <String > infoLogs = helper .getLogMock ().getInfo ();
100100 assertThat (infoLogs , hasSize (2 ));
101- assertThat (infoLogs .get (0 ), is ("Adding directory " + new File (temporaryFolder .getRoot (), "classes" ).getAbsolutePath () + " for package cycles search." ));
102- assertThat (infoLogs .get (1 ), is ("Adding directory " + new File (temporaryFolder .getRoot (), "test-classes" ).getAbsolutePath () + " for package cycles search." ));
101+ assertThat (infoLogs .get (0 ), is ("Adding directory " + classesFolder ().getAbsolutePath () + " for package cycles search." ));
102+ assertThat (infoLogs .get (1 ), is ("Adding directory " + testClassesFolder ().getAbsolutePath () + " for package cycles search." ));
103+ }
104+
105+ @ Test
106+ public void execute_CanExcludeTests () throws Exception {
107+ rule .setIncludeTests (false );
108+ rule .execute (helper );
109+ List <String > infoLogs = helper .getLogMock ().getInfo ();
110+ assertThat (infoLogs , hasSize (1 ));
111+ assertThat (infoLogs .get (0 ), is ("Adding directory " + classesFolder ().getAbsolutePath () + " for package cycles search." ));
103112 }
104113
105114 @ Test
@@ -109,7 +118,7 @@ public void execute_ContainsNoCyclesWithoutTestClasses() throws Exception {
109118 rule .execute (helper );
110119 List <String > infoLogs = helper .getLogMock ().getInfo ();
111120 assertThat (infoLogs , hasSize (2 ));
112- assertThat (infoLogs .get (0 ), is ("Adding directory " + new File ( temporaryFolder . getRoot (), "classes" ).getAbsolutePath () + " for package cycles search." ));
121+ assertThat (infoLogs .get (0 ), is ("Adding directory " + classesFolder ( ).getAbsolutePath () + " for package cycles search." ));
113122 assertThat (infoLogs .get (1 ), is ("Directory " + nonExistentTestClassesDir .getAbsolutePath () + " could not be found." ));
114123 }
115124
@@ -120,4 +129,12 @@ public void execute_ContainsCycles() throws Exception {
120129 expectedException .expectMessage (containsString ("There are package cycles" ));
121130 rule .execute (helper );
122131 }
132+
133+ private File testClassesFolder () {
134+ return new File (temporaryFolder .getRoot (), "test-classes" );
135+ }
136+
137+ private File classesFolder () {
138+ return new File (temporaryFolder .getRoot (), "classes" );
139+ }
123140}
0 commit comments