Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide better names for the test plan specification
- Moved factory methods from builder classes into interfaces and implementation classes - Removed builder classes Issue: #116
- Loading branch information
Showing
50 changed files
with
344 additions
and
538 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
junit-engine-api/src/main/java/org/junit/gen5/engine/MethodSelector.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* Copyright 2015-2016 the original author or authors. | ||
* | ||
* All rights reserved. This program and the accompanying materials are | ||
* made available under the terms of the Eclipse Public License v1.0 which | ||
* accompanies this distribution and is available at | ||
* | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
|
||
package org.junit.gen5.engine; | ||
|
||
import java.lang.reflect.Method; | ||
|
||
import org.junit.gen5.commons.util.ReflectionUtils; | ||
import org.junit.gen5.engine.DiscoverySelector; | ||
import org.junit.gen5.engine.DiscoverySelectorVisitor; | ||
|
||
/** | ||
* @since 5.0 | ||
*/ | ||
public class MethodSelector implements DiscoverySelector { | ||
public static MethodSelector forMethod(String testClassName, String testMethodName) { | ||
Class<?> testClass = getTestClass(testClassName); | ||
Method testMethod = getTestMethod(testClass, testMethodName); | ||
return forMethod(testClass, testMethod); | ||
} | ||
|
||
public static MethodSelector forMethod(Class<?> testClass, String testMethodName) { | ||
Method testMethod = getTestMethod(testClass, testMethodName); | ||
return forMethod(testClass, testMethod); | ||
} | ||
|
||
public static MethodSelector forMethod(Class<?> testClass, Method testMethod) { | ||
return new MethodSelector(testClass, testMethod); | ||
} | ||
|
||
private final Class<?> testClass; | ||
private final Method testMethod; | ||
|
||
private MethodSelector(Class<?> testClass, Method testMethod) { | ||
this.testClass = testClass; | ||
this.testMethod = testMethod; | ||
} | ||
|
||
@Override | ||
public void accept(DiscoverySelectorVisitor visitor) { | ||
visitor.visitMethod(testClass, testMethod); | ||
} | ||
|
||
public Class<?> getTestClass() { | ||
return testClass; | ||
} | ||
|
||
public Method getTestMethod() { | ||
return testMethod; | ||
} | ||
|
||
private static Class<?> getTestClass(String testClassName) { | ||
return ReflectionUtils.loadClass(testClassName).get(); | ||
} | ||
|
||
private static Method getTestMethod(Class<?> testClass, String testMethodName) { | ||
return ReflectionUtils.findMethod(testClass, testMethodName).get(); | ||
} | ||
} |
Oops, something went wrong.