Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
JUnit 4.13.2 Source Code Files
JUnit Source Code Files are provided in the
source package file, junit-4.13.2-sources.jar.
You can browse JUnit Source Code files below:
✍: FYIcenter.com
⏎ org/junit/experimental/results/ResultMatchers.java
package org.junit.experimental.results;
import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;
/**
* Matchers on a PrintableResult, to enable JUnit self-tests.
* For example:
*
* <pre>
* assertThat(testResult(HasExpectedException.class), isSuccessful());
* </pre>
*/
public class ResultMatchers {
/**
* Do not instantiate.
* @deprecated will be private soon.
*/
@Deprecated
public ResultMatchers() {
}
/**
* Matches if the tests are all successful
*/
public static Matcher<PrintableResult> isSuccessful() {
return failureCountIs(0);
}
/**
* Matches if there are {@code count} failures
*/
public static Matcher<PrintableResult> failureCountIs(final int count) {
return new TypeSafeMatcher<PrintableResult>() {
public void describeTo(Description description) {
description.appendText("has " + count + " failures");
}
@Override
public boolean matchesSafely(PrintableResult item) {
return item.failureCount() == count;
}
};
}
/**
* Matches if the result has exactly one failure, and it contains {@code string}
*/
public static Matcher<Object> hasSingleFailureContaining(final String string) {
return new BaseMatcher<Object>() {
public boolean matches(Object item) {
return item.toString().contains(string) && failureCountIs(1).matches(item);
}
public void describeTo(Description description) {
description.appendText("has single failure containing " + string);
}
};
}
/**
* Matches if the result has exactly one failure matching the given matcher.
*
* @since 4.13
*/
public static Matcher<PrintableResult> hasSingleFailureMatching(final Matcher<Throwable> matcher) {
return new TypeSafeMatcher<PrintableResult>() {
@Override
public boolean matchesSafely(PrintableResult item) {
return item.failureCount() == 1 && matcher.matches(item.failures().get(0).getException());
}
public void describeTo(Description description) {
description.appendText("has failure with exception matching ");
matcher.describeTo(description);
}
};
}
/**
* Matches if the result has one or more failures, and at least one of them
* contains {@code string}
*/
public static Matcher<PrintableResult> hasFailureContaining(final String string) {
return new TypeSafeMatcher<PrintableResult>() {
@Override
public boolean matchesSafely(PrintableResult item) {
return item.failureCount() > 0 && item.toString().contains(string);
}
public void describeTo(Description description) {
description.appendText("has failure containing " + string);
}
};
}
}
⏎ org/junit/experimental/results/ResultMatchers.java
Or download all of them as a single archive file:
File name: junit-4.13.2-sources.jar File size: 234540 bytes Release date: 2021-02-13 Download
⇒ Download and Install junit-4.12.jar
⇐ Download and Install junit-4.13.2.jar
2016-03-28, ≈51🔥, 0💬
Popular Posts:
What is the dom\ElementPrinter.java provided in the Apache Xerces package? I have Apache Xerces 2.11...
JDK 17 java.xml.crypto.jmod is the JMOD file for JDK 17 XML (eXtensible Markup Language) Crypto modu...
Where to get the Java source code for Connector/J 8.0 Core Impl module? Java source code files for C...
Apache Ant is a Java-based build tool. In theory, it is kind of like make, without make's wrinkles. ...
JDK 11 jdk.jlink.jmod is the JMOD file for JDK 11 JLink tool, which can be invoked by the "jlink" co...