Skip to content
This repository has been archived by the owner on Oct 22, 2019. It is now read-only.

Commit

Permalink
Apply patch from Mark Harrah
Browse files Browse the repository at this point in the history
Patch updates test-interface to 0.5. As part of the update JUnitRunner
now uses Runner2 rather than Runner and TestFingerprint. The
JUnitFingerprint is now a function of the @test annotation rather than a
marker interface and the NoMarkerFingerprint has been removed.
  • Loading branch information
bryanjswift committed Apr 15, 2010
1 parent 2de14a1 commit 75b12df
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 94 deletions.
16 changes: 4 additions & 12 deletions README.txt
Expand Up @@ -6,19 +6,10 @@ sbt without having to build a binary-compatible test framework first.

See LICENSE.txt for licensing conditions (BSD-style).

To use with xsbt 0.6, add the following dependency to your project:
To use with xsbt 0.7, add the following dependency to your project:

val bryanjswift = "Bryan J Swift Repository" at "http://repos.bryanjswift.com/maven2/"
val junitInterface = "com.novocode" %% "junit-interface" % "0.3.1"
override def testFrameworks = super.testFrameworks ++ List(new TestFramework("com.novocode.junit.JUnitFramework"))

Your test classes need to implement the marker interface com.novocode.junit.TestMarker in order
to be discovered. It is sufficient to add this to a test suite that bundles all test cases.

If you want to avoid the dependency on TestMarker, replace "JUnitFramework" above with
"JUnitFrameworkNoMarker". This causes all top-level classes built from the test sources to be
recognized as potential test cases. Classes with a @SuiteClasses annotation are not passed to
JUnit to avoid running test cases twice.
val junitInterface = "com.novocode" %% "junit-interface" % "0.4"

== Publishing ==

Expand All @@ -30,4 +21,5 @@ publishTo property or add a resolver file (.resolver by default, configurable wi
resolver.host=example.com
resolver.port=22
resolver.path=/path/to/publish/into/
resolver.type=sftp|ssh
resolver.type=sftp|ssh
=======
8 changes: 3 additions & 5 deletions project/build.properties
Expand Up @@ -2,9 +2,7 @@
#Sat Dec 12 19:08:47 CET 2009
project.organization=com.novocode
project.name=junit-interface
sbt.version=0.7.1
project.version=0.3.2
scala.version=2.7.5
def.scala.version=2.7.7
build.scala.versions=2.7.7 2.7.5 2.7.6
sbt.version=0.7.2
project.version=0.4.0
build.scala.versions=2.7.7
project.initialize=false
36 changes: 6 additions & 30 deletions project/build/src/JUnitInterfaceProject.scala
@@ -1,33 +1,21 @@
import sbt._
import scala.collection.Set
import scala.xml._
import java.io.{File, FileOutputStream}
import java.nio.channels.Channels
import java.io.File
import bjs.project.ResolverPlugin

class JUnitInterfaceProject(info: ProjectInfo) extends DefaultProject(info) with ResolverPlugin
{
val junit = "junit" % "junit" % "4.7"
val testInterface = "org.scala-tools.testing" % "test-interface" % "0.2"
val testInterface = "org.scala-tools.testing" % "test-interface" % "0.5"
override def javaCompileOptions = JavaCompileOption("-target") :: JavaCompileOption("1.5") :: Nil

/*********** Publishing ***********/
override def deliverScalaDependencies = Nil
override def disableCrossPaths = true
override def managedStyle = ManagedStyle.Maven

/*********** Extra meta-data for the POM ***********/
override def makePomAction = enrichPom dependsOn superMakePom
lazy val superMakePom = super.makePomAction
lazy val enrichPom = task {
val in = XML.loadFile(pomPath.asFile)
val out = <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
{in \ "modelVersion"}
{in \ "groupId"}
{in \ "artifactId"}
{in \ "packaging"}
<name>JUnitInterface</name>
{in \ "version"}
override def pomExtra =
(<name>JUnitInterface</name>
<url>http://github.com/szeiger/junit-interface/</url>
<inceptionYear>2009</inceptionYear>
<description>An implementation of sbt's test interface for JUnit 4</description>
Expand All @@ -54,17 +42,5 @@ class JUnitInterfaceProject(info: ProjectInfo) extends DefaultProject(info) with
</developers>
<scm>
<url>http://github.com/szeiger/junit-interface/</url>
</scm>
{in \ "dependencies"}
</project>
val fos = new FileOutputStream(pomPath.asFile)
try {
val w = Channels.newWriter(fos.getChannel(), "UTF-8")
try {
w.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n")
w.write(new PrettyPrinter(java.lang.Integer.MAX_VALUE, 2).format(out, TopScope))
} finally { w.close() }
} finally { fos.close() }
None
}
</scm>)
}
6 changes: 3 additions & 3 deletions src/main/java/com/novocode/junit/JUnitFingerprint.java
@@ -1,12 +1,12 @@
package com.novocode.junit;

import org.scalatools.testing.TestFingerprint;
import org.scalatools.testing.AnnotatedFingerprint;


public class JUnitFingerprint implements TestFingerprint
public class JUnitFingerprint implements AnnotatedFingerprint
{
@Override
public String superClassName() { return TestMarker.class.getName(); }
public String annotationName() { return "org.junit.Test"; }

@Override
public boolean isModule() { return false; }
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/novocode/junit/JUnitFramework.java
Expand Up @@ -3,12 +3,12 @@
import org.scalatools.testing.Framework;
import org.scalatools.testing.Logger;
import org.scalatools.testing.Runner;
import org.scalatools.testing.TestFingerprint;
import org.scalatools.testing.Fingerprint;


public final class JUnitFramework implements Framework
{
private static final TestFingerprint[] FINGERPRINTS = new TestFingerprint[] { new JUnitFingerprint() };
private static final Fingerprint[] FINGERPRINTS = new Fingerprint[] { new JUnitFingerprint() };

@Override
public String name() { return "JUnit"; }
Expand All @@ -20,5 +20,5 @@ public Runner testRunner(ClassLoader testClassLoader, Logger[] loggers)
}

@Override
public TestFingerprint[] tests() { return FINGERPRINTS; }
public Fingerprint[] tests() { return FINGERPRINTS; }
}
24 changes: 0 additions & 24 deletions src/main/java/com/novocode/junit/JUnitFrameworkNoMarker.java

This file was deleted.

8 changes: 4 additions & 4 deletions src/main/java/com/novocode/junit/JUnitRunner.java
Expand Up @@ -5,12 +5,12 @@
import org.junit.runner.JUnitCore;
import org.junit.runners.Suite.SuiteClasses;
import org.scalatools.testing.EventHandler;
import org.scalatools.testing.Fingerprint;
import org.scalatools.testing.Logger;
import org.scalatools.testing.Runner;
import org.scalatools.testing.TestFingerprint;
import org.scalatools.testing.Runner2;


final class JUnitRunner implements Runner
final class JUnitRunner extends Runner2
{
private static final String SUITE_ANNO = SuiteClasses.class.getName();
private final ClassLoader testClassLoader;
Expand All @@ -25,7 +25,7 @@ final class JUnitRunner implements Runner
}

@Override
public void run(String testClassName, TestFingerprint fingerprint, EventHandler eventHandler, String [] args)
public void run(String testClassName, Fingerprint fingerprint, EventHandler eventHandler, String [] args)
{
EventDispatcher ed = new EventDispatcher(logger, eventHandler);
JUnitCore ju = new JUnitCore();
Expand Down
13 changes: 0 additions & 13 deletions src/main/java/com/novocode/junit/NoMarkerFingerprint.java

This file was deleted.

0 comments on commit 75b12df

Please sign in to comment.