Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#41 Simplified filter tests in DefaultLauncherTests
- Loading branch information
Showing
3 changed files
with
58 additions
and
41 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
42 changes: 42 additions & 0 deletions
42
junit-tests/src/test/java/org/junit/gen5/launcher/PostDiscoveryFilterMock.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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,42 @@ | |||
/* | |||
* 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.launcher; | |||
|
|||
import java.util.function.Function; | |||
import java.util.function.Supplier; | |||
|
|||
import org.junit.gen5.engine.DiscoveryFilter; | |||
import org.junit.gen5.engine.FilterResult; | |||
import org.junit.gen5.engine.TestDescriptor; | |||
|
|||
public class PostDiscoveryFilterMock implements PostDiscoveryFilter { | |||
private final Function<Object, FilterResult> function; | |||
private final Supplier<String> toString; | |||
|
|||
public PostDiscoveryFilterMock(String toString) { | |||
this(o -> FilterResult.included("always"), () -> toString); | |||
} | |||
|
|||
public PostDiscoveryFilterMock(Function<Object, FilterResult> function, Supplier<String> toString) { | |||
this.function = function; | |||
this.toString = toString; | |||
} | |||
|
|||
@Override | |||
public String toString() { | |||
return toString.get(); | |||
} | |||
|
|||
@Override | |||
public FilterResult filter(TestDescriptor object) { | |||
return FilterResult.included("always"); | |||
} | |||
} |
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