Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Description seems to be heading towards Composite. Added "getTestName"

  • Loading branch information...
commit 90bf3119a6326671cc467386036302cc6040f752 1 parent c12af8e
authored December 20, 2008
1  .cvsignore
@@ -7,3 +7,4 @@ buildfile
7 7
 java.hprof.txt
8 8
 junit4.5-RC1
9 9
 junit4.*
  10
+*.ser
31  src/main/java/org/junit/runner/Description.java
@@ -198,24 +198,37 @@ public Description childlessCopy() {
198 198
 	}
199 199
 
200 200
 	// TODO (Nov 18, 2008 1:55:31 PM): do we want this here?
  201
+	// This seems like reasonable API once we "Composite-ize" Description
201 202
 	public Class<?> parseClass() {
202  
-		Matcher matcher= Pattern.compile("(.*)\\((.*)\\)").matcher(toString());
203  
-		if (matcher.matches())
204  
-			try {
205  
-				return Class.forName(matcher.group(2));
206  
-			} catch (ClassNotFoundException e) {
  203
+		String name= getClassName();
  204
+		if (name == null)
  205
+			return null;
  206
+		try {
  207
+			return Class.forName(name);
  208
+		} catch (ClassNotFoundException e) {
207 209
 				// TODO (Nov 18, 2008 1:54:36 PM): something better
208  
-				e.printStackTrace();
209  
-			}
210  
-		return null;
  210
+			e.printStackTrace();
  211
+			return null;
  212
+		}
211 213
 	}
212 214
 
213  
-	public String parseMethod() {
  215
+	public String getClassName() {
  216
+		Matcher matcher= Pattern.compile("(.*)\\((.*)\\)").matcher(toString());
  217
+		return matcher.matches()
  218
+			? matcher.group(2)
  219
+			: null;
  220
+	}
  221
+
  222
+	private String parseMethod() {
214 223
 		Matcher matcher= Pattern.compile("(.*)\\((.*)\\)").matcher(toString());
215 224
 		if (matcher.matches())
216 225
 			return matcher.group(1);
217 226
 		return null;
218 227
 	}
  228
+	
  229
+	public String getMethodName() {
  230
+		return parseMethod();
  231
+	}
219 232
 
220 233
 	// TODO (Nov 18, 2008 1:59:37 PM): circular
221 234
 	public Runner buildRunner() {
2  src/main/java/org/junit/runners/model/FrameworkMethod.java
... ...
@@ -1,4 +1,4 @@
1  
-package org.junit.runners.model;
  1
+package org.junit.runners.model; 
2 2
 
3 3
 import java.lang.annotation.Annotation;
4 4
 import java.lang.reflect.InvocationTargetException;
2  src/test/java/org/junit/tests/experimental/max/MaxStarterTest.java
@@ -252,7 +252,7 @@ public void parseClass_whenCantParse() {
252 252
 
253 253
 	@Test
254 254
 	public void parseMethod_whenCantParse() {
255  
-		assertNull(Description.TEST_MECHANISM.parseMethod());
  255
+		assertNull(Description.TEST_MECHANISM.getMethodName());
256 256
 	}
257 257
 
258 258
 	@Test

0 notes on commit 90bf311

Please sign in to comment.
Something went wrong with that request. Please try again.