public
Rubygem
Description: Apache Buildr
Homepage: http://incubator.apache.org/buildr
Clone URL: git://github.com/vic/buildr.git
BUILDR-89 JUnit (and all other Java frameworks) no longer include abstract 
classes.


git-svn-id: https://svn.apache.org/repos/asf/incubator/buildr/trunk@672436 
13f79535-47bb-0310-9956-ffa450edef68
assaf (author)
Fri Jun 27 17:18:07 -0700 2008
commit  85ff72a3f46df1ea3ac311e0331674e42b972ddb
tree    db2cf65acecff079b0a5e3ee5a88a7ff6cbfe8e4
parent  bc50c88cbc88bfeba3469f189e6199f2fb47d88f
...
18
19
20
 
21
22
23
...
70
71
72
 
 
73
74
75
...
113
114
115
116
117
 
...
18
19
20
21
22
23
24
...
71
72
73
74
75
76
77
78
...
116
117
118
 
119
120
0
@@ -18,6 +18,7 @@
0
 package org.apache.buildr;
0
 
0
 import java.lang.reflect.Method;
0
+import java.lang.reflect.Modifier;
0
 import java.io.File;
0
 import java.io.IOException;
0
 import java.net.URL;
0
@@ -70,6 +71,8 @@ public class JavaTestFilter {
0
   }
0
   
0
   private boolean isTest(Class cls) {
0
+ if (Modifier.isAbstract(cls.getModifiers()) || !Modifier.isPublic(cls.getModifiers()))
0
+ return false;
0
     if (interfaces != null) {
0
       for (Iterator it = interfaces.iterator(); it.hasNext(); ) {
0
         Class iface = (Class) it.next();
0
@@ -113,4 +116,4 @@ public class JavaTestFilter {
0
  * indent-tabs-mode: nil
0
  * c-basic-offset: 2
0
  * End:
0
- */
0
\ No newline at end of file
0
+ */
...
121
122
123
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
125
126
...
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
0
@@ -121,6 +121,25 @@ describe Buildr::JUnit do
0
     project('foo').test.tests.should eql(['InnerClassTest'])
0
   end
0
 
0
+ it 'should ignore abstract classes' do
0
+ write 'src/test/java/AbstractClassTest.java', <<-JAVA
0
+ public abstract class AbstractClassTest extends junit.framework.TestCase {
0
+ public void testNothing() { }
0
+ }
0
+ JAVA
0
+ define('foo').test.invoke
0
+ project('foo').test.tests.should be_empty
0
+ end
0
+
0
+ it 'should ignore classes with no tests in them' do
0
+ write 'src/test/java/NoTests.java', <<-JAVA
0
+ public class NoTests {
0
+ }
0
+ JAVA
0
+ define('foo').test.invoke
0
+ project('foo').test.tests.should be_empty
0
+ end
0
+
0
   it 'should pass when JUnit test case passes' do
0
     write 'src/test/java/PassingTest.java', <<-JAVA
0
       public class PassingTest extends junit.framework.TestCase {

Comments

    No one has commented yet.