Skip to content

Commit

Permalink
Add validation test to ws sample
Browse files Browse the repository at this point in the history
  • Loading branch information
dubu authored and Dave Syer committed Mar 12, 2014
1 parent d82a728 commit ba9f92e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
* A Basic Spring MVC Test for the Sample Controller"
*
* @author Biju Kunjummen
* @author Doo-Hwan, Kwak
*/
@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
Expand Down Expand Up @@ -55,6 +56,13 @@ public void testCreate() throws Exception {
.andExpect(header().string("location", RegexMatcher.matches("/[0-9]+")));
}

@Test
public void testCreateValidation() throws Exception{
this.mockMvc.perform(post("/").param("text", "").param("summary", ""))
.andExpect(status().isOk())
.andExpect(content().string(containsString("is required")));
}

private static class RegexMatcher extends TypeSafeMatcher<String> {
private final String regex;

Expand Down
2 changes: 1 addition & 1 deletion spring-boot-samples/spring-boot-sample-websocket/pom.xml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<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">
<modelVersion>4.0.0</modelVersion>
<artifactId>spring-boot-sample-websocket</artifactId>
<packaging>war</packaging>
<packaging>jar</packaging>
<parent>
<!-- Your own application should inherit from spring-boot-starter-parent -->
<groupId>org.springframework.boot</groupId>
Expand Down

0 comments on commit ba9f92e

Please sign in to comment.