├── .gitignore
├── .idea
├── copyright
│ └── profiles_settings.xml
├── runConfigurations
│ ├── All_Tests.xml
│ ├── build_hamcrest_1_3__junit_4_12.xml
│ └── build_hamcrest_2_0_0_0__junit_4_12.xml
└── scopes
│ └── scope_settings.xml
├── .travis.yml
├── LICENSE
├── README.md
├── build.gradle
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── publish-release
├── settings.gradle
├── src
├── main
│ └── java
│ │ └── org
│ │ └── hamcrest
│ │ └── junit
│ │ ├── ErrorCollector.java
│ │ ├── ExpectedException.java
│ │ ├── ExpectedExceptionMatcherBuilder.java
│ │ ├── JUnitMatchers.java
│ │ ├── MatcherAssert.java
│ │ ├── MatcherAssume.java
│ │ └── internal
│ │ ├── Matching.java
│ │ ├── MismatchAction.java
│ │ ├── StacktracePrintingMatcher.java
│ │ ├── ThrowableCauseMatcher.java
│ │ └── ThrowableMessageMatcher.java
└── test
│ └── java
│ └── org
│ └── hamcrest
│ └── junit
│ ├── AssertionTest.java
│ ├── AssumptionTest.java
│ ├── AssumptionViolatedExceptionTest.java
│ ├── EventCollector.java
│ ├── ExpectedExceptionTest.java
│ └── internal
│ └── StacktracePrintingMatcherTest.java
└── tag-release
/.gitignore:
--------------------------------------------------------------------------------
1 | build/
2 | *.iml
3 | .idea/*.xml
4 | .idea/libraries/
5 | .idea/.name
6 | .gradle/
7 | out/
8 | *.class
9 | *.jar
10 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
11 | hs_err_pid*
12 |
13 | gradle.properties
14 |
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/runConfigurations/All_Tests.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/.idea/runConfigurations/build_hamcrest_1_3__junit_4_12.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/.idea/runConfigurations/build_hamcrest_2_0_0_0__junit_4_12.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/.idea/scopes/scope_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: java
2 |
3 | jdk:
4 | - openjdk7
5 | - oraclejdk7
6 | - oraclejdk8
7 |
8 | script:
9 | - gradle clean test jar
10 |
11 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Hamcrest-JUnit
2 |
3 | Eclipse Public License - v 1.0
4 |
5 | THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC
6 | LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM
7 | CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
8 |
9 | 1. DEFINITIONS
10 |
11 | "Contribution" means:
12 |
13 | a) in the case of the initial Contributor, the initial code and
14 | documentation distributed under this Agreement, and
15 | b) in the case of each subsequent Contributor:
16 |
17 | i) changes to the Program, and
18 |
19 | ii) additions to the Program;
20 |
21 | where such changes and/or additions to the Program originate from and are
22 | distributed by that particular Contributor. A Contribution 'originates' from a
23 | Contributor if it was added to the Program by such Contributor itself or anyone
24 | acting on such Contributor's behalf. Contributions do not include additions to
25 | the Program which: (i) are separate modules of software distributed in
26 | conjunction with the Program under their own license agreement, and (ii) are
27 | not derivative works of the Program.
28 |
29 | "Contributor" means any person or entity that distributes the Program.
30 |
31 | "Licensed Patents " mean patent claims licensable by a Contributor which are
32 | necessarily infringed by the use or sale of its Contribution alone or when
33 | combined with the Program.
34 |
35 | "Program" means the Contributions distributed in accordance with this Agreement.
36 |
37 | "Recipient" means anyone who receives the Program under this Agreement,
38 | including all Contributors.
39 |
40 | 2. GRANT OF RIGHTS
41 |
42 | a) Subject to the terms of this Agreement, each Contributor hereby grants
43 | Recipient a non-exclusive, worldwide, royalty-free copyright license to
44 | reproduce, prepare derivative works of, publicly display, publicly perform,
45 | distribute and sublicense the Contribution of such Contributor, if any, and
46 | such derivative works, in source code and object code form.
47 |
48 | b) Subject to the terms of this Agreement, each Contributor hereby grants
49 | Recipient a non-exclusive, worldwide, royalty-free patent license under
50 | Licensed Patents to make, use, sell, offer to sell, import and otherwise
51 | transfer the Contribution of such Contributor, if any, in source code and
52 | object code form. This patent license shall apply to the combination of the
53 | Contribution and the Program if, at the time the Contribution is added by the
54 | Contributor, such addition of the Contribution causes such combination to be
55 | covered by the Licensed Patents. The patent license shall not apply to any
56 | other combinations which include the Contribution. No hardware per se is
57 | licensed hereunder.
58 |
59 | c) Recipient understands that although each Contributor grants the
60 | licenses to its Contributions set forth herein, no assurances are provided by
61 | any Contributor that the Program does not infringe the patent or other
62 | intellectual property rights of any other entity. Each Contributor disclaims
63 | any liability to Recipient for claims brought by any other entity based on
64 | infringement of intellectual property rights or otherwise. As a condition to
65 | exercising the rights and licenses granted hereunder, each Recipient hereby
66 | assumes sole responsibility to secure any other intellectual property rights
67 | needed, if any. For example, if a third party patent license is required to
68 | allow Recipient to distribute the Program, it is Recipient's responsibility to
69 | acquire that license before distributing the Program.
70 |
71 | d) Each Contributor represents that to its knowledge it has sufficient
72 | copyright rights in its Contribution, if any, to grant the copyright license
73 | set forth in this Agreement.
74 |
75 | 3. REQUIREMENTS
76 |
77 | A Contributor may choose to distribute the Program in object code form under
78 | its own license agreement, provided that:
79 |
80 | a) it complies with the terms and conditions of this Agreement; and
81 |
82 | b) its license agreement:
83 |
84 | i) effectively disclaims on behalf of all Contributors all warranties and
85 | conditions, express and implied, including warranties or conditions of title
86 | and non-infringement, and implied warranties or conditions of merchantability
87 | and fitness for a particular purpose;
88 |
89 | ii) effectively excludes on behalf of all Contributors all liability for
90 | damages, including direct, indirect, special, incidental and consequential
91 | damages, such as lost profits;
92 |
93 | iii) states that any provisions which differ from this Agreement are
94 | offered by that Contributor alone and not by any other party; and
95 |
96 | iv) states that source code for the Program is available from such
97 | Contributor, and informs licensees how to obtain it in a reasonable manner on
98 | or through a medium customarily used for software exchange.
99 |
100 | When the Program is made available in source code form:
101 |
102 | a) it must be made available under this Agreement; and
103 |
104 | b) a copy of this Agreement must be included with each copy of the
105 | Program.
106 |
107 | Contributors may not remove or alter any copyright notices contained within the
108 | Program.
109 |
110 | Each Contributor must identify itself as the originator of its Contribution, if
111 | any, in a manner that reasonably allows subsequent Recipients to identify the
112 | originator of the Contribution.
113 |
114 | 4. COMMERCIAL DISTRIBUTION
115 |
116 | Commercial distributors of software may accept certain responsibilities with
117 | respect to end users, business partners and the like. While this license is
118 | intended to facilitate the commercial use of the Program, the Contributor who
119 | includes the Program in a commercial product offering should do so in a manner
120 | which does not create potential liability for other Contributors. Therefore, if
121 | a Contributor includes the Program in a commercial product offering, such
122 | Contributor ("Commercial Contributor") hereby agrees to defend and indemnify
123 | every other Contributor ("Indemnified Contributor") against any losses, damages
124 | and costs (collectively "Losses") arising from claims, lawsuits and other legal
125 | actions brought by a third party against the Indemnified Contributor to the
126 | extent caused by the acts or omissions of such Commercial Contributor in
127 | connection with its distribution of the Program in a commercial product
128 | offering. The obligations in this section do not apply to any claims or Losses
129 | relating to any actual or alleged intellectual property infringement. In order
130 | to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
131 | Contributor in writing of such claim, and b) allow the Commercial Contributor
132 | to control, and cooperate with the Commercial Contributor in, the defense and
133 | any related settlement negotiations. The Indemnified Contributor may
134 | participate in any such claim at its own expense.
135 |
136 | For example, a Contributor might include the Program in a commercial product
137 | offering, Product X. That Contributor is then a Commercial Contributor. If that
138 | Commercial Contributor then makes performance claims, or offers warranties
139 | related to Product X, those performance claims and warranties are such
140 | Commercial Contributor's responsibility alone. Under this section, the
141 | Commercial Contributor would have to defend claims against the other
142 | Contributors related to those performance claims and warranties, and if a court
143 | requires any other Contributor to pay any damages as a result, the Commercial
144 | Contributor must pay those damages.
145 |
146 | 5. NO WARRANTY
147 |
148 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN
149 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR
150 | IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
151 | NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each
152 | Recipient is solely responsible for determining the appropriateness of using
153 | and distributing the Program and assumes all risks associated with its exercise
154 | of rights under this Agreement, including but not limited to the risks and
155 | costs of program errors, compliance with applicable laws, damage to or loss of
156 | data, programs or equipment, and unavailability or interruption of operations.
157 |
158 | 6. DISCLAIMER OF LIABILITY
159 |
160 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY
161 | CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL,
162 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST
163 | PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
164 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
165 | WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS
166 | GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
167 |
168 | 7. GENERAL
169 |
170 | If any provision of this Agreement is invalid or unenforceable under applicable
171 | law, it shall not affect the validity or enforceability of the remainder of the
172 | terms of this Agreement, and without further action by the parties hereto, such
173 | provision shall be reformed to the minimum extent necessary to make such
174 | provision valid and enforceable.
175 |
176 | If Recipient institutes patent litigation against any
177 | entity (including a cross-claim or counterclaim in a lawsuit) alleging that the
178 | Program itself (excluding combinations of the Program with other software or
179 | hardware) infringes such Recipient's patent(s), then such Recipient's rights
180 | granted under Section 2(b) shall terminate as of the date such litigation is
181 | filed.
182 |
183 | All Recipient's rights under this Agreement shall terminate if it fails to
184 | comply with any of the material terms or conditions of this Agreement and does
185 | not cure such failure in a reasonable period of time after becoming aware of
186 | such noncompliance. If all Recipient's rights under this Agreement terminate,
187 | Recipient agrees to cease use and distribution of the Program as soon as
188 | reasonably practicable. However, Recipient's obligations under this Agreement
189 | and any licenses granted by Recipient relating to the Program shall continue
190 | and survive.
191 |
192 | Everyone is permitted to copy and distribute copies of this Agreement, but in
193 | order to avoid inconsistency the Agreement is copyrighted and may only be
194 | modified in the following manner. The Agreement Steward reserves the right to
195 | publish new versions (including revisions) of this Agreement from time to time.
196 | No one other than the Agreement Steward has the right to modify this Agreement.
197 | The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to
198 | serve as the Agreement Steward to a suitable separate entity. Each new version
199 | of the Agreement will be given a distinguishing version number. The Program
200 | (including Contributions) may always be distributed subject to the version of
201 | the Agreement under which it was received. In addition, after a new version of
202 | the Agreement is published, Contributor may elect to distribute the Program
203 | (including its Contributions) under the new version. Except as expressly stated
204 | in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
205 | the intellectual property of any Contributor under this Agreement, whether
206 | expressly, by implication, estoppel or otherwise. All rights in the Program not
207 | expressly granted under this Agreement are reserved.
208 |
209 | This Agreement is governed by the laws of the State of New York and the
210 | intellectual property laws of the United States of America. No party to this
211 | Agreement will bring a legal action under this Agreement more than one year
212 | after the cause of action arose. Each party waives its rights to a jury trial
213 | in any resulting litigation.
214 |
215 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | hamcrest-junit
2 | ==============
3 |
4 | Integration between Hamcrest and JUnit
5 |
6 | See https://github.com/hamcrest/JavaHamcrest/issues/92
7 |
8 | The Travis CI build is here: https://travis-ci.org/hamcrest/hamcrest-junit. [](https://travis-ci.org/hamcrest/hamcrest-junit)
9 |
10 | Compatibility
11 | -------------
12 |
13 | Recommended/compatible version of hamcrest-junit per Hamcrest and JUnit version:
14 |
15 | | | **JUnit 4.12** |
16 | |----------------------|---------------:|
17 | | **Hamcrest 1.3** | 1.0.0.1 |
18 | | **Hamcrest 2.0.0.0** | 2.0.0.0 |
19 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'java'
2 | apply plugin: 'maven'
3 | apply plugin: 'signing'
4 |
5 | archivesBaseName = "hamcrest-junit"
6 | group = "org.hamcrest"
7 | version = hasProperty("-version") ? property("-version") : "SNAPSHOT"
8 |
9 | def junit = System.getenv("junit") ?: 'junit:junit:4.12'
10 | def hamcrest = System.getenv("hamcrest") ?: 'org.hamcrest:java-hamcrest:2.0.0.0'
11 |
12 | sourceCompatibility = "1.7"
13 |
14 | repositories {
15 | mavenCentral()
16 | }
17 |
18 | dependencies {
19 | compile (junit) { transitive = false }
20 | compile (hamcrest) { transitive = false }
21 | }
22 |
23 | test {
24 | filter {
25 | includeTestsMatching "*Test"
26 | }
27 | }
28 |
29 | jar {
30 | manifest {
31 | attributes 'Implementation-Title': 'hamcrest-junit',
32 | 'Implementation-Vendor': 'hamcrest.org',
33 | 'Implementation-Version': version
34 | }
35 | }
36 |
37 | task sourcesJar(type: Jar) {
38 | classifier = 'sources'
39 | from sourceSets.main.allSource
40 | }
41 |
42 | task javadocJar(type: Jar, dependsOn: javadoc) {
43 | classifier = 'javadoc'
44 | from javadoc
45 | }
46 |
47 | artifacts {
48 | archives jar, sourcesJar, javadocJar
49 | }
50 |
51 |
52 | signing {
53 | required { gradle.taskGraph.hasTask("uploadArchives") }
54 | sign configurations.archives
55 | }
56 |
57 | String publishUsername = hasProperty("ossrhUsername") ? property("ossrhUsername") : ""
58 | String publishPassword = hasProperty("ossrhPassword") ? property("ossrhPassword") : ""
59 |
60 | uploadArchives {
61 | repositories.mavenDeployer {
62 | beforeDeployment { deployment -> signing.signPom(deployment) }
63 |
64 | repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
65 | authentication(userName: publishUsername, password: publishPassword)
66 | }
67 | snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
68 | authentication(userName: publishUsername, password: publishPassword)
69 | }
70 |
71 | pom.project {
72 | name 'Hamcrest JUnit'
73 | packaging 'jar'
74 | description 'Classes to use Hamcrest matchers within JUnit tests'
75 | url 'https://github.com/hamcrest/hamcrest-junit'
76 |
77 | scm {
78 | connection 'git@github.com:hamcrest/hamcrest-junit.git'
79 | url 'https://github.com/hamcrest/hamcrest-junit'
80 | }
81 |
82 | licenses {
83 | license {
84 | name 'Eclipse Public License - v 1.0'
85 | url 'http://opensource.org/licenses/EPL-1.0'
86 | }
87 | }
88 |
89 | developers {
90 | developer {
91 | id 'npryce'
92 | name 'Nat Pryce'
93 | }
94 | developer {
95 | id 'sf105'
96 | name 'Steve Freeman'
97 | }
98 | }
99 | }
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hamcrest/hamcrest-junit/5e02d55230b560f255433bcc490afaeda9e1a043/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Jun 01 17:51:01 CEST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-bin.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/publish-release:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | set -e
3 |
4 | required_javac_version=1.7.0
5 |
6 | javac_version=`javac -version 2>&1 | cut -c 7-`
7 | case ${javac_version} in
8 | ${required_javac_version}_*)
9 | echo building with java ${javac_version}
10 | ;;
11 | *)
12 | echo ERROR found Java ${javac_version}, requires ${required_javac_version}
13 | exit 1
14 | ;;
15 | esac
16 |
17 | version=`git describe --always --tags --match 'v*' --dirty="_patched" | cut -c 2-`
18 | `dirname $0`/gradlew -P-version=$version clean uploadArchives "$@"
19 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'hamcrest-junit'
2 |
--------------------------------------------------------------------------------
/src/main/java/org/hamcrest/junit/ErrorCollector.java:
--------------------------------------------------------------------------------
1 | package org.hamcrest.junit;
2 |
3 | import static org.hamcrest.junit.MatcherAssert.assertThat;
4 |
5 | import java.util.ArrayList;
6 | import java.util.List;
7 | import java.util.concurrent.Callable;
8 |
9 | import org.hamcrest.Matcher;
10 | import org.junit.rules.Verifier;
11 | import org.junit.runners.model.MultipleFailureException;
12 |
13 | /**
14 | * The ErrorCollector rule allows execution of a test to continue after the
15 | * first problem is found (for example, to collect _all_ the incorrect rows in a
16 | * table, and report them all at once):
17 | *
18 | *
19 | * public static class UsesErrorCollectorTwice {
20 | * @Rule
21 | * public ErrorCollector collector= new ErrorCollector();
22 | *
23 | * @Test
24 | * public void example() {
25 | * collector.addError(new Throwable("first thing went wrong"));
26 | * collector.addError(new Throwable("second thing went wrong"));
27 | * collector.checkThat(getResult(), not(containsString("ERROR!")));
28 | * // all lines will run, and then a combined failure logged at the end.
29 | * }
30 | * }
31 | *
32 | *
33 | * @since 4.7
34 | */
35 | public class ErrorCollector extends Verifier {
36 | private List errors = new ArrayList();
37 |
38 | @Override
39 | protected void verify() throws Throwable {
40 | MultipleFailureException.assertEmpty(errors);
41 | }
42 |
43 | /**
44 | * Adds a Throwable to the table. Execution continues, but the test will fail at the end.
45 | */
46 | public void addError(Throwable error) {
47 | errors.add(error);
48 | }
49 |
50 | /**
51 | * Adds a failure to the table if {@code matcher} does not match {@code value}.
52 | * Execution continues, but the test will fail at the end if the match fails.
53 | */
54 | public void checkThat(final T value, final Matcher matcher) {
55 | checkThat("", value, matcher);
56 | }
57 |
58 | /**
59 | * Adds a failure with the given {@code reason}
60 | * to the table if {@code matcher} does not match {@code value}.
61 | * Execution continues, but the test will fail at the end if the match fails.
62 | */
63 | public void checkThat(final String reason, final T value, final Matcher matcher) {
64 | checkSucceeds(new Callable