Skip to content

Commit

Permalink
Build against hamcrest 2.0.0.0
Browse files Browse the repository at this point in the history
 - fix compile errors due to looser generic bounds
 - remove @factory annotations
 - make Gradle file take hamcrest and junit versions from environment variables, for use in matrix CI builds
  • Loading branch information
npryce committed Jan 26, 2015
1 parent 6ddfbc1 commit 951721f
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 7 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions .idea/runConfigurations/build_hamcrest_2_0_0_0__junit_4_12.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,18 @@ archivesBaseName = "hamcrest-junit"
group = "org.hamcrest"
version = hasProperty("-version") ? property("-version") : "SNAPSHOT"

def junit = System.getenv("junit") ?: 'junit:junit:4.12'
def hamcrest = System.getenv("hamcrest") ?: 'org.hamcrest:java-hamcrest:2.0.0.0'

sourceCompatibility = "1.7"

repositories {
mavenCentral()
}

dependencies {
compile group: 'junit', name: 'junit', version: '4.12', transitive: false
compile group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3', transitive: false
compile (junit) { transitive = false }
compile (hamcrest) { transitive = false }
}

test {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/hamcrest/junit/JUnitMatchers.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static <T> Matcher<Iterable<T>> hasItems(Matcher<? super T>... elementMat
* @deprecated Please use {@link CoreMatchers#everyItem(Matcher)} instead.
*/
@Deprecated
public static <T> Matcher<Iterable<T>> everyItem(final Matcher<T> elementMatcher) {
public static <T> Matcher<Iterable<? extends T>> everyItem(final Matcher<T> elementMatcher) {
return CoreMatchers.everyItem(elementMatcher);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import java.io.StringWriter;

import org.hamcrest.Description;
import org.hamcrest.Factory;
import org.hamcrest.Matcher;

/**
Expand Down Expand Up @@ -42,13 +41,11 @@ private String readStacktrace(Throwable throwable) {
return stringWriter.toString();
}

@Factory
public static <T extends Throwable> Matcher<T> isThrowable(
Matcher<T> throwableMatcher) {
return new StacktracePrintingMatcher<T>(throwableMatcher);
}

@Factory
public static <T extends Exception> Matcher<T> isException(
Matcher<T> exceptionMatcher) {
return new StacktracePrintingMatcher<T>(exceptionMatcher);
Expand Down

0 comments on commit 951721f

Please sign in to comment.