Skip to content

Commit

Permalink
#132: Moved execution specific classes to execution subpackage
Browse files Browse the repository at this point in the history
  • Loading branch information
jlink committed Jan 22, 2016
1 parent a59b066 commit 7e16787
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 20 deletions.
Expand Up @@ -8,7 +8,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*/

package org.junit.gen5.engine.junit5.descriptor;
package org.junit.gen5.engine.junit5.execution;

import static org.junit.gen5.api.Assertions.*;

Expand All @@ -21,6 +21,10 @@
import org.junit.gen5.commons.reporting.ReportEntry;
import org.junit.gen5.engine.EngineExecutionListener;
import org.junit.gen5.engine.TestDescriptor;
import org.junit.gen5.engine.junit5.descriptor.ClassBasedContainerExtensionContext;
import org.junit.gen5.engine.junit5.descriptor.ClassTestDescriptor;
import org.junit.gen5.engine.junit5.descriptor.MethodBasedTestExtensionContext;
import org.junit.gen5.engine.junit5.descriptor.MethodTestDescriptor;
import org.mockito.Mockito;

/**
Expand Down
Expand Up @@ -8,14 +8,15 @@
* http://www.eclipse.org/legal/epl-v10.html
*/

package org.junit.gen5.engine.junit5.descriptor;
package org.junit.gen5.engine.junit5.execution;

import static org.junit.gen5.api.Assertions.*;

import org.junit.gen5.api.BeforeEach;
import org.junit.gen5.api.Nested;
import org.junit.gen5.api.Test;
import org.junit.gen5.api.extension.ExtensionContext.*;
import org.junit.gen5.engine.junit5.execution.ExtensionValuesStore;

/**
* Microtests for {@link ExtensionValuesStore}
Expand Down
Expand Up @@ -16,6 +16,8 @@
import org.junit.gen5.commons.reporting.ReportEntry;
import org.junit.gen5.engine.EngineExecutionListener;
import org.junit.gen5.engine.TestDescriptor;
import org.junit.gen5.engine.junit5.execution.ExtensionValuesStore;
import org.junit.gen5.engine.junit5.execution.NamespaceAwareStore;

/**
* @since 5.0
Expand Down
Expand Up @@ -16,7 +16,8 @@
import org.junit.gen5.api.extension.ExtensionContext;
import org.junit.gen5.engine.*;

final class ClassBasedContainerExtensionContext extends AbstractExtensionContext implements ContainerExtensionContext {
final public class ClassBasedContainerExtensionContext extends AbstractExtensionContext
implements ContainerExtensionContext {

public ClassBasedContainerExtensionContext(ExtensionContext parent, EngineExecutionListener engineExecutionListener,
ClassTestDescriptor testDescriptor) {
Expand Down
Expand Up @@ -11,7 +11,7 @@
package org.junit.gen5.engine.junit5.descriptor;

import static org.junit.gen5.commons.util.AnnotationUtils.findAnnotatedMethods;
import static org.junit.gen5.engine.junit5.descriptor.MethodInvocationContextFactory.methodInvocationContext;
import static org.junit.gen5.engine.junit5.execution.MethodInvocationContextFactory.methodInvocationContext;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
Expand Down Expand Up @@ -42,6 +42,7 @@
import org.junit.gen5.engine.junit5.execution.JUnit5EngineExecutionContext;
import org.junit.gen5.engine.junit5.execution.MethodInvoker;
import org.junit.gen5.engine.junit5.execution.TestInstanceProvider;
import org.junit.gen5.engine.junit5.execution.ThrowableCollector;
import org.junit.gen5.engine.junit5.extension.ExtensionRegistry;
import org.junit.gen5.engine.junit5.extension.RegisteredExtensionPoint;
import org.junit.gen5.engine.support.descriptor.JavaSource;
Expand Down
Expand Up @@ -17,7 +17,7 @@
import org.junit.gen5.api.extension.TestExtensionContext;
import org.junit.gen5.engine.*;

final class MethodBasedTestExtensionContext extends AbstractExtensionContext implements TestExtensionContext {
final public class MethodBasedTestExtensionContext extends AbstractExtensionContext implements TestExtensionContext {

private final Object testInstance;

Expand Down
Expand Up @@ -10,7 +10,7 @@

package org.junit.gen5.engine.junit5.descriptor;

import static org.junit.gen5.engine.junit5.descriptor.MethodInvocationContextFactory.methodInvocationContext;
import static org.junit.gen5.engine.junit5.execution.MethodInvocationContextFactory.methodInvocationContext;

import java.lang.reflect.Method;
import java.util.List;
Expand All @@ -33,6 +33,7 @@
import org.junit.gen5.engine.junit5.execution.ConditionEvaluator;
import org.junit.gen5.engine.junit5.execution.JUnit5EngineExecutionContext;
import org.junit.gen5.engine.junit5.execution.MethodInvoker;
import org.junit.gen5.engine.junit5.execution.ThrowableCollector;
import org.junit.gen5.engine.junit5.extension.ExtensionRegistry;
import org.junit.gen5.engine.junit5.extension.ExtensionRegistry.ApplicationOrder;
import org.junit.gen5.engine.junit5.extension.RegisteredExtensionPoint;
Expand Down
Expand Up @@ -8,7 +8,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*/

package org.junit.gen5.engine.junit5.descriptor;
package org.junit.gen5.engine.junit5.execution;

import java.util.HashMap;
import java.util.Map;
Expand All @@ -18,11 +18,12 @@
import org.junit.gen5.commons.util.Preconditions;

/**
* {@code ExtensionValuesStore} is used inside {@link AbstractExtensionContext}
* {@code ExtensionValuesStore} is used inside implementations of
* {@link org.junit.gen5.api.extension.ExtensionContext}
* to store and retrieve attributes with {@link #get}, {@link #put}, or
* {@link #getOrComputeIfAbsent}.
*/
class ExtensionValuesStore {
public class ExtensionValuesStore {

private final ExtensionValuesStore parentStore;
private final Map<Object, StoredValue> storedValues = new HashMap<>();
Expand All @@ -31,7 +32,7 @@ class ExtensionValuesStore {
this(null);
}

ExtensionValuesStore(ExtensionValuesStore parentStore) {
public ExtensionValuesStore(ExtensionValuesStore parentStore) {
this.parentStore = parentStore;
}

Expand Down
Expand Up @@ -8,7 +8,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*/

package org.junit.gen5.engine.junit5.descriptor;
package org.junit.gen5.engine.junit5.execution;

import java.lang.reflect.Method;

Expand All @@ -19,13 +19,13 @@
*
* @since 5.0
*/
class MethodInvocationContextFactory {
public class MethodInvocationContextFactory {

/**
* Create a new {@link MethodInvocationContext} based on the supplied
* {@code instance} and {@code method}.
*/
static MethodInvocationContext methodInvocationContext(Object instance, Method method) {
public static MethodInvocationContext methodInvocationContext(Object instance, Method method) {
return new DefaultMethodInvocationContext(instance, method);
}

Expand Down
Expand Up @@ -8,7 +8,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*/

package org.junit.gen5.engine.junit5.descriptor;
package org.junit.gen5.engine.junit5.execution;

import java.util.function.Function;

Expand All @@ -18,12 +18,12 @@
/**
* @since 5.0
*/
class NamespaceAwareStore implements Store {
public class NamespaceAwareStore implements Store {

private final ExtensionValuesStore valuesStore;
private final Namespace namespace;

NamespaceAwareStore(ExtensionValuesStore valuesStore, Namespace namespace) {
public NamespaceAwareStore(ExtensionValuesStore valuesStore, Namespace namespace) {
this.valuesStore = valuesStore;
this.namespace = namespace;
}
Expand Down
Expand Up @@ -8,7 +8,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*/

package org.junit.gen5.engine.junit5.descriptor;
package org.junit.gen5.engine.junit5.execution;

import java.util.ArrayList;
import java.util.Collections;
Expand All @@ -24,7 +24,7 @@
*
* @since 5.0
*/
class ThrowableCollector {
public class ThrowableCollector {

private final List<Throwable> throwables = new ArrayList<>();

Expand All @@ -37,7 +37,7 @@ class ThrowableCollector {
* @see #getThrowables()
* @see #assertEmpty()
*/
void execute(Executable executable) {
public void execute(Executable executable) {
try {
executable.execute();
}
Expand Down Expand Up @@ -84,7 +84,7 @@ List<Throwable> getThrowables() {
*
* @see ExceptionUtils#throwAsUncheckedException(Throwable)
*/
void assertEmpty() {
public void assertEmpty() {
if (!this.throwables.isEmpty()) {
Throwable t = this.throwables.get(0);
this.throwables.stream().skip(1).forEach(t::addSuppressed);
Expand Down

0 comments on commit 7e16787

Please sign in to comment.