Permalink
Browse files

Add Spring MVC Test framework

This commit adds the spring-test-mvc project [1] to the Spring
Framework as part of the spring-test module.

The sources are added as a root-level project called "spring-test-mvc"
instead of under "spring-test" because the new sources need to be
compiled with Servlet 3 while the current "spring-test" sources require
Servlet 2.5 and the Eclipse IDE does not support having different
classpaths for the same project.

The Gradle build produces a single spring-test jar that contains
sources from both "spring-test" and "spring-test-mvc". This merge is
made possible through merge-dist.gradle as follows:

- jar tasks of the "from" project execute tasks of the "to" project
- "to" project is added to the classpath of the "from" project
- "to" project pom is updated with entries from the "from" project

For further details see documentation in merge-dist.gradle.

Special thanks to everyone who contributed to the initial development
of the Spring MVC Test framework:

 Arjen Poutsma <poutsma@mac.com>
 Craig Walls <cwalls@vmware.com>
 Frans Flippo <fransflippo@utopia.orange11.nl>
 Harry Lascelles <harry@firstbanco.com>
 Irfan <mail.urfi@gmail.com>
 Jörg Rathlev <joerg.rathlev@s24.com>
 Keesun Baik <whiteship2000@gmail.com>
 Keesun Baik <whiteship@epril.com>
 Matthew Reid <matthew.reid@nakedwines.com>
 Nils-Helge Garli Hegvik <Nils-Helge.Hegvik@telenor.com>
 Rob Winch <rwinch@vmware.com>
 Scott Frederick <sfrederick@vmware.com>
 Sven Filatov <sven.filatov@gmail.com>
 Thomas Bruyelle <thomas.bruyelle@gmail.com>
 youngm <youngm@gmail.com>

[1]: https://github.com/SpringSource/spring-test-mvc

Issue: SPR-9859, SPR-7951
  • Loading branch information...
rwinch authored and rstoyanchev committed Sep 28, 2012
1 parent 4812c18 commit 22bcb54ab66c952d1c122526729b64d77a77280b
Showing with 14,278 additions and 0 deletions.
  1. +42 −0 build.gradle
  2. +72 −0 merge-dist.gradle
  3. +1 −0 settings.gradle
  4. +79 −0 spring-test-mvc/src/main/java/org/springframework/test/web/mock/AssertionErrors.java
  5. +207 −0 spring-test-mvc/src/main/java/org/springframework/test/web/mock/client/MockRestServiceServer.java
  6. +39 −0 spring-test-mvc/src/main/java/org/springframework/test/web/mock/client/RequestMatcher.java
  7. +79 −0 ...t-mvc/src/main/java/org/springframework/test/web/mock/client/RequestMatcherClientHttpRequest.java
  8. +39 −0 spring-test-mvc/src/main/java/org/springframework/test/web/mock/client/ResponseActions.java
  9. +39 −0 spring-test-mvc/src/main/java/org/springframework/test/web/mock/client/ResponseCreator.java
  10. +170 −0 ...test-mvc/src/main/java/org/springframework/test/web/mock/client/match/ContentRequestMatchers.java
  11. +128 −0 ...est-mvc/src/main/java/org/springframework/test/web/mock/client/match/JsonPathRequestMatchers.java
  12. +263 −0 spring-test-mvc/src/main/java/org/springframework/test/web/mock/client/match/RequestMatchers.java
  13. +178 −0 ...g-test-mvc/src/main/java/org/springframework/test/web/mock/client/match/XpathRequestMatchers.java
  14. +23 −0 spring-test-mvc/src/main/java/org/springframework/test/web/mock/client/match/package-info.java
  15. +21 −0 spring-test-mvc/src/main/java/org/springframework/test/web/mock/client/package-info.java
  16. +132 −0 ...t-mvc/src/main/java/org/springframework/test/web/mock/client/response/DefaultResponseCreator.java
  17. +189 −0 ...ng-test-mvc/src/main/java/org/springframework/test/web/mock/client/response/ResponseCreators.java
  18. +23 −0 spring-test-mvc/src/main/java/org/springframework/test/web/mock/client/response/package-info.java
  19. +99 −0 spring-test-mvc/src/main/java/org/springframework/test/web/mock/servlet/DefaultMvcResult.java
  20. +167 −0 spring-test-mvc/src/main/java/org/springframework/test/web/mock/servlet/MockMvc.java
  21. +35 −0 spring-test-mvc/src/main/java/org/springframework/test/web/mock/servlet/MockMvcBuilder.java
  22. +77 −0 spring-test-mvc/src/main/java/org/springframework/test/web/mock/servlet/MockMvcBuilderSupport.java
  23. +78 −0 spring-test-mvc/src/main/java/org/springframework/test/web/mock/servlet/MvcResult.java
  24. +27 −0 spring-test-mvc/src/main/java/org/springframework/test/web/mock/servlet/RequestBuilder.java
  25. +70 −0 spring-test-mvc/src/main/java/org/springframework/test/web/mock/servlet/ResultActions.java
  26. +47 −0 spring-test-mvc/src/main/java/org/springframework/test/web/mock/servlet/ResultHandler.java
  27. +48 −0 spring-test-mvc/src/main/java/org/springframework/test/web/mock/servlet/ResultMatcher.java
  28. +153 −0 spring-test-mvc/src/main/java/org/springframework/test/web/mock/servlet/TestDispatcherServlet.java
  29. +21 −0 spring-test-mvc/src/main/java/org/springframework/test/web/mock/servlet/package-info.java
  30. +131 −0 ...ng-test-mvc/src/main/java/org/springframework/test/web/mock/servlet/request/MockAsyncContext.java
  31. +694 −0 ...rc/main/java/org/springframework/test/web/mock/servlet/request/MockHttpServletRequestBuilder.java
  32. +121 −0 ...ava/org/springframework/test/web/mock/servlet/request/MockMultipartHttpServletRequestBuilder.java
  33. +107 −0 ...t-mvc/src/main/java/org/springframework/test/web/mock/servlet/request/MockMvcRequestBuilders.java
  34. +45 −0 ...est-mvc/src/main/java/org/springframework/test/web/mock/servlet/request/RequestPostProcessor.java
  35. +103 −0 ...c/main/java/org/springframework/test/web/mock/servlet/request/Servlet3MockHttpServletRequest.java
  36. +98 −0 ...va/org/springframework/test/web/mock/servlet/request/Servlet3MockMultipartHttpServletRequest.java
  37. +23 −0 spring-test-mvc/src/main/java/org/springframework/test/web/mock/servlet/request/package-info.java
  38. +175 −0 ...est-mvc/src/main/java/org/springframework/test/web/mock/servlet/result/ContentResultMatchers.java
  39. +198 −0 ...test-mvc/src/main/java/org/springframework/test/web/mock/servlet/result/CookieResultMatchers.java
  40. +87 −0 .../src/main/java/org/springframework/test/web/mock/servlet/result/FlashAttributeResultMatchers.java
  41. +113 −0 ...est-mvc/src/main/java/org/springframework/test/web/mock/servlet/result/HandlerResultMatchers.java
  42. +73 −0 ...test-mvc/src/main/java/org/springframework/test/web/mock/servlet/result/HeaderResultMatchers.java
  43. +101 −0 ...st-mvc/src/main/java/org/springframework/test/web/mock/servlet/result/JsonPathResultMatchers.java
  44. +66 −0 ...est-mvc/src/main/java/org/springframework/test/web/mock/servlet/result/MockMvcResultHandlers.java
  45. +185 −0 ...est-mvc/src/main/java/org/springframework/test/web/mock/servlet/result/MockMvcResultMatchers.java
  46. +175 −0 ...-test-mvc/src/main/java/org/springframework/test/web/mock/servlet/result/ModelResultMatchers.java
  47. +200 −0 ...est-mvc/src/main/java/org/springframework/test/web/mock/servlet/result/PrintingResultHandler.java
  48. +153 −0 ...est-mvc/src/main/java/org/springframework/test/web/mock/servlet/result/RequestResultMatchers.java
  49. +544 −0 ...test-mvc/src/main/java/org/springframework/test/web/mock/servlet/result/StatusResultMatchers.java
  50. +63 −0 ...g-test-mvc/src/main/java/org/springframework/test/web/mock/servlet/result/ViewResultMatchers.java
  51. +160 −0 ...-test-mvc/src/main/java/org/springframework/test/web/mock/servlet/result/XpathResultMatchers.java
  52. +23 −0 spring-test-mvc/src/main/java/org/springframework/test/web/mock/servlet/result/package-info.java
  53. +206 −0 ...test-mvc/src/main/java/org/springframework/test/web/mock/servlet/setup/DefaultMockMvcBuilder.java
  54. +74 −0 spring-test-mvc/src/main/java/org/springframework/test/web/mock/servlet/setup/MockMvcBuilders.java
  55. +130 −0 ...-mvc/src/main/java/org/springframework/test/web/mock/servlet/setup/PatternMappingFilterProxy.java
  56. +382 −0 ...t-mvc/src/main/java/org/springframework/test/web/mock/servlet/setup/StandaloneMockMvcBuilder.java
  57. +343 −0 ...-mvc/src/main/java/org/springframework/test/web/mock/servlet/setup/StubWebApplicationContext.java
  58. +22 −0 spring-test-mvc/src/main/java/org/springframework/test/web/mock/servlet/setup/package-info.java
  59. +122 −0 ...-test-mvc/src/main/java/org/springframework/test/web/mock/support/JsonPathExpectationsHelper.java
  60. +96 −0 spring-test-mvc/src/main/java/org/springframework/test/web/mock/support/XmlExpectationsHelper.java
  61. +213 −0 spring-test-mvc/src/main/java/org/springframework/test/web/mock/support/XpathExpectationsHelper.java
  62. +20 −0 spring-test-mvc/src/main/java/org/springframework/test/web/mock/support/package-info.java
  63. +88 −0 spring-test-mvc/src/test/java/org/springframework/test/web/mock/Person.java
  64. +102 −0 ...mvc/src/test/java/org/springframework/test/web/mock/client/MockClientHttpRequestFactoryTests.java
  65. +123 −0 ...mvc/src/test/java/org/springframework/test/web/mock/client/match/ContentRequestMatchersTests.java
  66. +93 −0 ...vc/src/test/java/org/springframework/test/web/mock/client/match/JsonPathRequestMatchersTests.java
  67. +139 −0 ...g-test-mvc/src/test/java/org/springframework/test/web/mock/client/match/RequestMatchersTests.java
  68. +113 −0 ...t-mvc/src/test/java/org/springframework/test/web/mock/client/match/XpathRequestMatchersTests.java
  69. +130 −0 ...st-mvc/src/test/java/org/springframework/test/web/mock/client/response/ResponseCreatorsTests.java
  70. +116 −0 spring-test-mvc/src/test/java/org/springframework/test/web/mock/client/samples/SampleTests.java
  71. +103 −0 ...st/java/org/springframework/test/web/mock/client/samples/matchers/ContentRequestMatcherTests.java
  72. +85 −0 ...est/java/org/springframework/test/web/mock/client/samples/matchers/HeaderRequestMatcherTests.java
  73. +150 −0 ...t/java/org/springframework/test/web/mock/client/samples/matchers/JsonPathRequestMatcherTests.java
  74. +133 −0 ...java/org/springframework/test/web/mock/client/samples/matchers/XmlContentRequestMatcherTests.java
  75. +233 −0 ...test/java/org/springframework/test/web/mock/client/samples/matchers/XpathRequestMatcherTests.java
  76. +123 −0 spring-test-mvc/src/test/java/org/springframework/test/web/mock/servlet/StubMvcResult.java
  77. +390 −0 ...st/java/org/springframework/test/web/mock/servlet/request/MockHttpServletRequestBuilderTests.java
  78. +91 −0 ...vc/src/test/java/org/springframework/test/web/mock/servlet/result/ContentResultMatchersTests.java
  79. +56 −0 ...test/java/org/springframework/test/web/mock/servlet/result/FlashAttributeResultMatchersTests.java
  80. +92 −0 ...c/src/test/java/org/springframework/test/web/mock/servlet/result/JsonPathResultMatchersTests.java
  81. +141 −0 ...-mvc/src/test/java/org/springframework/test/web/mock/servlet/result/ModelResultMatchersTests.java
  82. +238 −0 ...vc/src/test/java/org/springframework/test/web/mock/servlet/result/PrintingResultHandlerTests.java
  83. +82 −0 ...mvc/src/test/java/org/springframework/test/web/mock/servlet/result/StatusResultMatchersTests.java
  84. +111 −0 ...-mvc/src/test/java/org/springframework/test/web/mock/servlet/result/XpathResultMatchersTests.java
  85. +94 −0 .../test/java/org/springframework/test/web/mock/servlet/samples/context/GenericWebContextLoader.java
  86. +63 −0 ...src/test/java/org/springframework/test/web/mock/servlet/samples/context/JavaTestContextTests.java
  87. +231 −0 ...java/org/springframework/test/web/mock/servlet/samples/context/SecurityRequestPostProcessors.java
  88. +135 −0 .../src/test/java/org/springframework/test/web/mock/servlet/samples/context/SpringSecurityTests.java
  89. +62 −0 ...g-test-mvc/src/test/java/org/springframework/test/web/mock/servlet/samples/context/WebConfig.java
  90. +24 −0 ...mvc/src/test/java/org/springframework/test/web/mock/servlet/samples/context/WebContextLoader.java
  91. +66 −0 .../src/test/java/org/springframework/test/web/mock/servlet/samples/context/XmlTestContextTests.java
  92. +83 −0 ...st-mvc/src/test/java/org/springframework/test/web/mock/servlet/samples/standalone/AsyncTests.java
  93. +63 −0 ...test/java/org/springframework/test/web/mock/servlet/samples/standalone/ExceptionHandlerTests.java
  94. +171 −0 ...t-mvc/src/test/java/org/springframework/test/web/mock/servlet/samples/standalone/FilterTests.java
  95. +103 −0 ...mvc/src/test/java/org/springframework/test/web/mock/servlet/samples/standalone/RedirectTests.java
  96. +110 −0 ...c/test/java/org/springframework/test/web/mock/servlet/samples/standalone/RequestBuilderTests.java
  97. +61 −0 ...test/java/org/springframework/test/web/mock/servlet/samples/standalone/RequestParameterTests.java
  98. +59 −0 ...src/test/java/org/springframework/test/web/mock/servlet/samples/standalone/ResponseBodyTests.java
  99. +160 −0 ...c/test/java/org/springframework/test/web/mock/servlet/samples/standalone/ViewResolutionTests.java
  100. +49 −0 ...framework/test/web/mock/servlet/samples/standalone/resulthandlers/PrintingResultHandlerTests.java
  101. +106 −0 ...pringframework/test/web/mock/servlet/samples/standalone/resultmatchers/ContentAssertionTests.java
  102. +114 −0 ...springframework/test/web/mock/servlet/samples/standalone/resultmatchers/CookieAssertionTests.java
  103. +93 −0 ...amework/test/web/mock/servlet/samples/standalone/resultmatchers/FlashAttributeAssertionTests.java
  104. +85 −0 ...pringframework/test/web/mock/servlet/samples/standalone/resultmatchers/HandlerAssertionTests.java
  105. +102 −0 ...springframework/test/web/mock/servlet/samples/standalone/resultmatchers/HeaderAssertionTests.java
  106. +146 −0 ...ringframework/test/web/mock/servlet/samples/standalone/resultmatchers/JsonPathAssertionTests.java
  107. +124 −0 .../springframework/test/web/mock/servlet/samples/standalone/resultmatchers/ModelAssertionTests.java
  108. +77 −0 ...ework/test/web/mock/servlet/samples/standalone/resultmatchers/RequestAttributeAssertionTests.java
  109. +83 −0 ...ework/test/web/mock/servlet/samples/standalone/resultmatchers/SessionAttributeAssertionTests.java
  110. +103 −0 ...springframework/test/web/mock/servlet/samples/standalone/resultmatchers/StatusAssertionTests.java
  111. +68 −0 ...rg/springframework/test/web/mock/servlet/samples/standalone/resultmatchers/UrlAssertionTests.java
  112. +69 −0 ...ringframework/test/web/mock/servlet/samples/standalone/resultmatchers/ViewNameAssertionTests.java
  113. +123 −0 ...ngframework/test/web/mock/servlet/samples/standalone/resultmatchers/XmlContentAssertionTests.java
  114. +202 −0 .../springframework/test/web/mock/servlet/samples/standalone/resultmatchers/XpathAssertionTests.java
  115. +272 −0 ...t/java/org/springframework/test/web/mock/servlet/setup/ConditionalDelegatingFilterProxyTests.java
  116. +82 −0 ...mvc/src/test/java/org/springframework/test/web/mock/servlet/setup/DefaultMockMvcBuilderTests.java
  117. +12 −0 spring-test-mvc/src/test/resources/META-INF/web-resources/WEB-INF/layouts/standardLayout.jsp
  118. +8 −0 spring-test-mvc/src/test/resources/META-INF/web-resources/WEB-INF/layouts/tiles.xml
  119. +2 −0 spring-test-mvc/src/test/resources/META-INF/web-resources/WEB-INF/views/home.jsp
  120. +10 −0 spring-test-mvc/src/test/resources/META-INF/web-resources/WEB-INF/views/tiles.xml
  121. +16 −0 spring-test-mvc/src/test/resources/META-INF/web-resources/resources/Spring.js
  122. +7 −0 spring-test-mvc/src/test/resources/log4j.properties
  123. +5 −0 spring-test-mvc/src/test/resources/org/springframework/test/web/mock/client/samples/ludwig.json
  124. +14 −0 .../resources/org/springframework/test/web/mock/servlet/samples/context/TestContextTests-context.xml
  125. +18 −0 ...est-mvc/src/test/resources/org/springframework/test/web/mock/servlet/samples/context/security.xml
  126. +31 −0 ...test-mvc/src/test/resources/org/springframework/test/web/mock/servlet/samples/servlet-context.xml
  127. +12 −0 spring-test-mvc/src/test/webapp/WEB-INF/layouts/main.jsp
  128. +8 −0 spring-test-mvc/src/test/webapp/WEB-INF/layouts/tiles.xml
  129. +2 −0 spring-test-mvc/src/test/webapp/WEB-INF/readme.txt
  130. +8 −0 spring-test-mvc/src/test/webapp/WEB-INF/views/tiles.xml
  131. +16 −0 spring-test-mvc/src/test/webapp/resources/Spring.js
  132. +2 −0 spring-test-mvc/test-mvc.gradle
View
@@ -548,6 +548,48 @@ project('spring-test') {
}
}
project('spring-test-mvc') {
description = 'Spring Test MVC Framework'
apply from: 'test-mvc.gradle'
dependencies {
compile project(":spring-context")
compile project(":spring-webmvc")
compile project(":spring-test").sourceSets.main.output
compile("org.apache.tomcat:tomcat-servlet-api:7.0.8", provided)
compile "org.hamcrest:hamcrest-all:1.1"
compile("com.jayway.jsonpath:json-path:0.8.1", optional)
compile("xmlunit:xmlunit:1.2", optional)
testCompile("org.slf4j:jcl-over-slf4j:1.6.1")
testCompile("org.slf4j:slf4j-log4j12:1.6.1") {
exclude group: 'log4j', module: 'log4j'
}
testCompile("log4j:log4j:1.2.15") {
exclude group: 'javax.mail', module: 'mail'
exclude group: 'javax.jms', module: 'jms'
exclude group: 'com.sun.jdmk', module: 'jmxtools'
exclude group: 'com.sun.jmx', module: 'jmxri'
}
testCompile "javax.servlet:jstl:1.2"
testCompile "org.apache.tiles:tiles-jsp:2.2.2"
testCompile "org.hibernate:hibernate-validator:4.2.0.Final"
testCompile "org.codehaus.jackson:jackson-mapper-asl:1.4.2"
testCompile project(":spring-oxm")
testCompile "com.thoughtworks.xstream:xstream:1.3.1"
testCompile "cglib:cglib-nodep:2.2"
testCompile "rome:rome:1.0"
testCompile "javax.xml.bind:jaxb-api:2.2.6"
testCompile("org.springframework.security:spring-security-core:3.1.2.RELEASE") {
exclude group: 'org.springframework'
}
testCompile("org.springframework.security:spring-security-web:3.1.2.RELEASE") {
exclude group: 'org.springframework'
}
testCompile("org.springframework.security:spring-security-config:3.1.2.RELEASE") {
exclude group: 'org.springframework'
}
}
}
project('spring-struts') {
description = 'Spring Struts'
dependencies {
View
@@ -0,0 +1,72 @@
import org.gradle.plugins.ide.eclipse.model.ProjectDependency
/**
* Will merge the distributions of the current project into mergeIntoProject. For
* example, to bundle spring-test-mvc in spring-test's jars. This script will perform the
* following steps:
* <ul>
* <li>Ensure that jar tasks of the project being merged from will execute the tasks of
* the project being merged into</li>
* <li>Add the project being merged into to the classpath of the project being merged
* from</li>
* <li>Update the pom.xml of the project being merged into to contain the entries from
* the project being merged from</li>
* </ul>
*
* Example Usage:
*
* ext.mergeIntoProject = project(':spring-test')
* apply from: "${rootProject.projectDir}/merge-dist.gradle"
*/
def mergeFromProject = project
// invoking a task on mergeFromProject will invoke the task with the same name on mergeIntoProject
def taskNamesToMerge = ['sourcesJar','jar','javadocJar','javadoc','install']
taskNamesToMerge.each { taskName ->
def taskToRemove = tasks.getByPath(taskName)
taskToRemove.enabled = false
taskToRemove.dependsOn mergeIntoProject."$taskName"
}
// update mergeIntoProject artifacts to contain the mergeFromProject artifact contents
mergeIntoProject."sourcesJar" {
from mergeFromProject.sourcesJar.source
}
mergeIntoProject."jar" {
from mergeFromProject.jar.source
}
mergeIntoProject."javadoc" {
source += mergeFromProject.javadoc.source
classpath += mergeFromProject.javadoc.classpath
}
// GRADLE-1116
mergeFromProject.eclipse.classpath.file.whenMerged { classpath ->
classpath.entries.removeAll { entry -> entry.path.contains("/${mergeIntoProject.name}/build/") }
def dependency = new ProjectDependency("/${mergeIntoProject.name}", mergeIntoProject.path)
dependency.exported = true
classpath.entries.add(dependency)
}
// Update mergeIntoProject to contain additional configurations that contains all the dependencies from mergeFromProject
// so that Maven pom generation works
gradle.taskGraph.whenReady {
mergeFromProject.configurations.archives.artifacts.clear()
mergeFromProject.configurations.each { config->
def mapping = mergeFromProject.conf2ScopeMappings.getMapping([config])
if(mapping.scope) {
def newConfigName = mergeFromProject.name + "-"+ config.name
mergeIntoProject.configurations.add(newConfigName)
config.dependencies.each { dependency ->
mergeIntoProject.dependencies.add(newConfigName, dependency)
}
configure(mergeIntoProject.install.repositories.mavenInstaller.pom.scopeMappings) {
addMapping(mapping.priority + 100, mergeIntoProject.configurations."$newConfigName", mapping.scope)
}
mergeIntoProject.optionalDeps += mergeFromProject.optionalDeps
mergeIntoProject.providedDeps += mergeFromProject.providedDeps
}
}
}
View
@@ -15,6 +15,7 @@ include 'spring-orm'
include 'spring-oxm'
include 'spring-struts'
include 'spring-test'
include 'spring-test-mvc'
include 'spring-tx'
include 'spring-web'
include 'spring-webmvc'
@@ -0,0 +1,79 @@
/*
* Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.web.mock;
/**
* JUnit independent assertion class.
*
* @author Lukas Krecan
* @author Arjen Poutsma
* @since 3.2
*/
public abstract class AssertionErrors {
private AssertionErrors() {
}
/**
* Fails a test with the given message.
*
* @param message the message
*/
public static void fail(String message) {
throw new AssertionError(message);
}
/**
* Fails a test with the given message passing along expected and actual values to be added to the message.
*
* @param message the message
* @param expected the expected value
* @param actual the actual value
*/
public static void fail(String message, Object expected, Object actual) {
throw new AssertionError(message + " expected:<" + expected + "> but was:<" + actual + ">");
}
/**
* Asserts that a condition is {@code true}. If not, throws an {@link AssertionError} with the given message.
*
* @param message the message
* @param condition the condition to test for
*/
public static void assertTrue(String message, boolean condition) {
if (!condition) {
fail(message);
}
}
/**
* Asserts that two objects are equal. If not, an {@link AssertionError} is thrown with the given message.
*
* @param message the message
* @param expected the expected value
* @param actual the actual value
*/
public static void assertEquals(String message, Object expected, Object actual) {
if (expected == null && actual == null) {
return;
}
if (expected != null && expected.equals(actual)) {
return;
}
fail(message, expected, actual);
}
}
Oops, something went wrong.

0 comments on commit 22bcb54

Please sign in to comment.