forked from scalameta/munit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
56 changed files
with
749 additions
and
214 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
10 changes: 10 additions & 0 deletions
10
junit-interface/src/main/java/munit/internal/junitinterface/MUnitEngineDescriptor.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,10 @@ | ||
package munit.internal.junitinterface; | ||
|
||
import org.junit.platform.engine.UniqueId; | ||
import org.junit.platform.engine.support.descriptor.EngineDescriptor; | ||
|
||
public class MUnitEngineDescriptor extends EngineDescriptor { | ||
public MUnitEngineDescriptor(UniqueId uniqueId) { | ||
super(uniqueId, "MUnit"); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
junit-interface/src/main/java/munit/internal/junitinterface/MUnitRunListener.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,31 @@ | ||
package munit.internal.junitinterface; | ||
|
||
import org.junit.platform.engine.EngineExecutionListener; | ||
import org.junit.runner.Description; | ||
import org.junit.runner.notification.RunListener; | ||
|
||
public class MUnitRunListener extends RunListener { | ||
private final EngineExecutionListener listener; | ||
|
||
public MUnitRunListener(EngineExecutionListener listener) { | ||
this.listener = listener; | ||
} | ||
|
||
@Override | ||
public void testSuiteFinished(Description description) throws Exception { | ||
System.out.println("STARTED SUITE" + description); | ||
super.testSuiteFinished(description); | ||
} | ||
|
||
@Override | ||
public void testStarted(Description description) throws Exception { | ||
System.out.println("STARTED TEST" + description); | ||
super.testStarted(description); | ||
} | ||
|
||
@Override | ||
public void testFinished(Description description) throws Exception { | ||
System.out.println("FINISHED TEST" + description); | ||
super.testFinished(description); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
junit-interface/src/main/resources/META-INF/services/org.junit.platform.engine.TestEngine
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 @@ | ||
munit.MUnitTestEngine |
This file was deleted.
Oops, something went wrong.
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
24 changes: 0 additions & 24 deletions
24
munit/non-jvm/src/main/scala/munit/internal/junitinterface/IncludeFilter.scala
This file was deleted.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
munit/non-jvm/src/main/scala/org/junit/platform/engine/ConfigurationParameters.scala
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,3 @@ | ||
package org.junit.platform.engine | ||
|
||
class ConfigurationParameters |
3 changes: 3 additions & 0 deletions
3
munit/non-jvm/src/main/scala/org/junit/platform/engine/DiscoveryFilter.scala
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,3 @@ | ||
package org.junit.platform.engine | ||
|
||
trait DiscoveryFilter[T] |
3 changes: 3 additions & 0 deletions
3
munit/non-jvm/src/main/scala/org/junit/platform/engine/DiscoverySelector.scala
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,3 @@ | ||
package org.junit.platform.engine | ||
|
||
trait DiscoverySelector |
6 changes: 6 additions & 0 deletions
6
munit/non-jvm/src/main/scala/org/junit/platform/engine/EngineDiscoveryListener.scala
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,6 @@ | ||
package org.junit.platform.engine | ||
|
||
class EngineDiscoveryListener | ||
object EngineDiscoveryListener { | ||
val NOOP = new EngineDiscoveryListener | ||
} |
19 changes: 19 additions & 0 deletions
19
munit/non-jvm/src/main/scala/org/junit/platform/engine/EngineDiscoveryRequest.scala
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,19 @@ | ||
package org.junit.platform.engine | ||
|
||
import org.junit.platform.engine.DiscoverySelector | ||
import java.{util => ju} | ||
import org.junit.platform.engine.DiscoveryFilter | ||
import org.junit.platform.engine.ConfigurationParameters | ||
import org.junit.platform.engine.EngineDiscoveryListener | ||
|
||
trait EngineDiscoveryRequest { | ||
def getSelectorsByType[T <: DiscoverySelector]( | ||
selectorType: Class[T] | ||
): ju.List[T] | ||
def getFiltersByType[T <: DiscoveryFilter[_]]( | ||
selectorType: Class[T] | ||
): ju.List[T] | ||
def getConfigurationParameters(): ConfigurationParameters | ||
def getDiscoveryListener(): EngineDiscoveryListener = | ||
EngineDiscoveryListener.NOOP | ||
} |
18 changes: 18 additions & 0 deletions
18
munit/non-jvm/src/main/scala/org/junit/platform/engine/EngineExecutionListener.scala
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,18 @@ | ||
package org.junit.platform.engine | ||
|
||
import org.junit.platform.engine.reporting.ReportEntry | ||
|
||
trait EngineExecutionListener { | ||
def dynamicTestRegisterd(testDescriptor: TestDescriptor): Unit = () | ||
def executionSkipped(testDescriptor: TestDescriptor, reason: String): Unit = | ||
() | ||
def executionStarted(testDescriptor: TestDescriptor): Unit = () | ||
def executionFinished( | ||
testDescriptor: TestDescriptor, | ||
testExecutionResult: TestExecutionResult | ||
): Unit = () | ||
def reportingEntryPublished( | ||
testDescriptor: TestDescriptor, | ||
entry: ReportEntry | ||
): Unit = () | ||
} |
3 changes: 3 additions & 0 deletions
3
munit/non-jvm/src/main/scala/org/junit/platform/engine/ExecutionRequest.scala
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,3 @@ | ||
package org.junit.platform.engine | ||
|
||
class ExecutionRequest |
32 changes: 32 additions & 0 deletions
32
munit/non-jvm/src/main/scala/org/junit/platform/engine/TestDescriptor.scala
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,32 @@ | ||
package org.junit.platform.engine | ||
|
||
import java.{util => ju} | ||
|
||
trait TestDescriptor { | ||
def getUniqueId(): UniqueId | ||
def getDisplayName(): String | ||
def getTags(): ju.Set[TestTag] | ||
def getSource(): ju.Optional[TestSource] | ||
def getParent(): ju.Optional[TestDescriptor] | ||
def setParent(parent: TestDescriptor): Unit | ||
def getChildren(): ju.Set[_ <: TestDescriptor] | ||
def addChild(descriptor: TestDescriptor): Unit | ||
def removeChild(descriptor: TestDescriptor): Unit | ||
def isRoot(): Boolean = !getParent().isPresent() | ||
def getType(): TestDescriptor.Type | ||
} | ||
|
||
object TestDescriptor { | ||
abstract class Type extends Serializable { | ||
def isContainer: Boolean = | ||
this == Type.CONTAINER || this == Type.CONTAINER_AND_TEST | ||
def isTest: Boolean = | ||
this == Type.TEST || this == Type.CONTAINER_AND_TEST | ||
} | ||
object Type { | ||
case object CONTAINER extends Type | ||
case object TEST extends Type | ||
case object CONTAINER_AND_TEST extends Type | ||
} | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
munit/non-jvm/src/main/scala/org/junit/platform/engine/TestEngine.scala
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,15 @@ | ||
package org.junit.platform.engine | ||
|
||
import java.util.Optional | ||
|
||
trait TestEngine { | ||
def getId: String | ||
def discover( | ||
request: EngineDiscoveryRequest, | ||
uniqueId: UniqueId | ||
): TestDescriptor | ||
def execute(request: ExecutionRequest): Unit | ||
def getArtifactId: Optional[String] = Optional.empty() | ||
def getGroupId: Optional[String] = Optional.empty() | ||
def getVersion: Optional[String] = Optional.empty() | ||
} |
27 changes: 27 additions & 0 deletions
27
munit/non-jvm/src/main/scala/org/junit/platform/engine/TestExecutionResult.scala
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,27 @@ | ||
package org.junit.platform.engine | ||
|
||
import java.util.Optional | ||
|
||
class TestExecutionResult( | ||
status: TestExecutionResult.Status, | ||
throwable: Throwable | ||
) { | ||
def getStatus(): TestExecutionResult.Status = status | ||
def getThrowable(): Optional[Throwable] = Optional.ofNullable(throwable) | ||
override def toString(): String = | ||
s"TestExectionResult [status = ${status}, throwable = ${throwable}]" | ||
} | ||
object TestExecutionResult { | ||
private val SUCCESSFUL_RESULT = new TestExecutionResult(SUCCESSFUL, null) | ||
def successful(): TestExecutionResult = | ||
SUCCESSFUL_RESULT | ||
def aborted(throwable: Throwable): TestExecutionResult = | ||
new TestExecutionResult(ABORTED, throwable) | ||
def failed(throwable: Throwable): TestExecutionResult = | ||
new TestExecutionResult(FAILED, throwable) | ||
|
||
sealed abstract class Status extends Serializable | ||
case object SUCCESSFUL extends Status | ||
case object ABORTED extends Status | ||
case object FAILED extends Status | ||
} |
3 changes: 3 additions & 0 deletions
3
munit/non-jvm/src/main/scala/org/junit/platform/engine/TestSource.scala
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,3 @@ | ||
package org.junit.platform.engine | ||
|
||
abstract class TestSource |
7 changes: 7 additions & 0 deletions
7
munit/non-jvm/src/main/scala/org/junit/platform/engine/TestTag.scala
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,7 @@ | ||
package org.junit.platform.engine | ||
class TestTag(name: String) { | ||
def getName(): String = name | ||
} | ||
object TestTag { | ||
def create(name: String): TestTag = new TestTag(name) | ||
} |
6 changes: 6 additions & 0 deletions
6
munit/non-jvm/src/main/scala/org/junit/platform/engine/UniqueId.scala
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,6 @@ | ||
package org.junit.platform.engine | ||
|
||
class UniqueId(kind: String, name: String) | ||
object UniqueId { | ||
def root(kind: String, name: String): UniqueId = new UniqueId(kind, name) | ||
} |
26 changes: 26 additions & 0 deletions
26
munit/non-jvm/src/main/scala/org/junit/platform/engine/reporting/ReportEntry.scala
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,26 @@ | ||
package org.junit.platform.engine.reporting | ||
|
||
import java.{util => ju} | ||
|
||
final class ReportEntry { | ||
val timestamp = new java.util.Date() | ||
val keyValuePairs = new ju.LinkedHashMap[String, String] | ||
private def add(key: String, value: String): Unit = | ||
keyValuePairs.put(key, value) | ||
def getKeyValuePairs(): ju.Map[String, String] = | ||
ju.Collections.unmodifiableMap(keyValuePairs) | ||
override def toString(): String = | ||
s"ReportEntry [timestamp = $timestamp${}, keyValuePairs = ${keyValuePairs}]" | ||
} | ||
object ReportEntry { | ||
def from(keyValuePairs: ju.Map[String, String]): ReportEntry = { | ||
val reportEntry = new ReportEntry | ||
keyValuePairs.forEach((a, b) => reportEntry.add(a, b)) | ||
reportEntry | ||
} | ||
def from(key: String, value: String): ReportEntry = { | ||
val reportEntry = new ReportEntry | ||
reportEntry.add(key, value) | ||
reportEntry | ||
} | ||
} |
Oops, something went wrong.