Polishing

This commit is contained in:
Juergen Hoeller
2016-07-26 17:15:15 +02:00
parent 7b564b72a1
commit e03dea1d64
193 changed files with 324 additions and 323 deletions

View File

@@ -49,12 +49,12 @@ public class MockFilterChainTests {
this.response = new MockHttpServletResponse();
}
@Test(expected=IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class)
public void constructorNullServlet() {
new MockFilterChain((Servlet) null);
}
@Test(expected=IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class)
public void constructorNullFilter() {
new MockFilterChain(mock(Servlet.class), (Filter) null);
}

View File

@@ -28,7 +28,7 @@ import org.springframework.test.context.TestExecutionListeners;
import static org.springframework.test.context.junit4.JUnitTestingUtils.*;
/**
* Verifies proper handling of JUnit's {@link Test#expected() @Test(expected=...)}
* Verifies proper handling of JUnit's {@link Test#expected() @Test(expected = ...)}
* support in conjunction with the {@link SpringRunner}.
*
* @author Sam Brannen

View File

@@ -46,7 +46,7 @@ public class XpathRequestMatchersTests {
new XpathRequestMatchers("/foo/bar", null).node(Matchers.notNullValue()).match(this.request);
}
@Test(expected=AssertionError.class)
@Test(expected = AssertionError.class)
public void testNodeMatcherNoMatch() throws Exception {
new XpathRequestMatchers("/foo/bar", null).node(Matchers.nullValue()).match(this.request);
}
@@ -56,7 +56,7 @@ public class XpathRequestMatchersTests {
new XpathRequestMatchers("/foo/bar", null).exists().match(this.request);
}
@Test(expected=AssertionError.class)
@Test(expected = AssertionError.class)
public void testExistsNoMatch() throws Exception {
new XpathRequestMatchers("/foo/Bar", null).exists().match(this.request);
}
@@ -66,7 +66,7 @@ public class XpathRequestMatchersTests {
new XpathRequestMatchers("/foo/Bar", null).doesNotExist().match(this.request);
}
@Test(expected=AssertionError.class)
@Test(expected = AssertionError.class)
public void testDoesNotExistNoMatch() throws Exception {
new XpathRequestMatchers("/foo/bar", null).doesNotExist().match(this.request);
}
@@ -76,7 +76,7 @@ public class XpathRequestMatchersTests {
new XpathRequestMatchers("/foo/bar", null).nodeCount(2).match(this.request);
}
@Test(expected=AssertionError.class)
@Test(expected = AssertionError.class)
public void testNodeCountNoMatch() throws Exception {
new XpathRequestMatchers("/foo/bar", null).nodeCount(1).match(this.request);
}
@@ -86,7 +86,7 @@ public class XpathRequestMatchersTests {
new XpathRequestMatchers("/foo/bar[1]", null).string("111").match(this.request);
}
@Test(expected=AssertionError.class)
@Test(expected = AssertionError.class)
public void testStringNoMatch() throws Exception {
new XpathRequestMatchers("/foo/bar[1]", null).string("112").match(this.request);
}
@@ -96,7 +96,7 @@ public class XpathRequestMatchersTests {
new XpathRequestMatchers("/foo/bar[1]", null).number(111.0).match(this.request);
}
@Test(expected=AssertionError.class)
@Test(expected = AssertionError.class)
public void testNumberNoMatch() throws Exception {
new XpathRequestMatchers("/foo/bar[1]", null).number(111.1).match(this.request);
}
@@ -106,7 +106,7 @@ public class XpathRequestMatchersTests {
new XpathRequestMatchers("/foo/bar[2]", null).booleanValue(true).match(this.request);
}
@Test(expected=AssertionError.class)
@Test(expected = AssertionError.class)
public void testBooleanNoMatch() throws Exception {
new XpathRequestMatchers("/foo/bar[2]", null).booleanValue(false).match(this.request);
}

View File

@@ -32,7 +32,7 @@ public class ContentResultMatchersTests {
new ContentResultMatchers().contentType("application/json;charset=UTF-8").match(getStubMvcResult());
}
@Test(expected=AssertionError.class)
@Test(expected = AssertionError.class)
public void typeNoMatch() throws Exception {
new ContentResultMatchers().contentType("text/plain").match(getStubMvcResult());
}
@@ -42,7 +42,7 @@ public class ContentResultMatchersTests {
new ContentResultMatchers().encoding("UTF-8").match(getStubMvcResult());
}
@Test(expected=AssertionError.class)
@Test(expected = AssertionError.class)
public void encodingNoMatch() throws Exception {
new ContentResultMatchers().encoding("ISO-8859-1").match(getStubMvcResult());
}
@@ -52,7 +52,7 @@ public class ContentResultMatchersTests {
new ContentResultMatchers().string(new String(CONTENT.getBytes("UTF-8"))).match(getStubMvcResult());
}
@Test(expected=AssertionError.class)
@Test(expected = AssertionError.class)
public void stringNoMatch() throws Exception {
new ContentResultMatchers().encoding("bogus").match(getStubMvcResult());
}
@@ -63,7 +63,7 @@ public class ContentResultMatchersTests {
new ContentResultMatchers().string(Matchers.equalTo(content)).match(getStubMvcResult());
}
@Test(expected=AssertionError.class)
@Test(expected = AssertionError.class)
public void stringMatcherNoMatch() throws Exception {
new ContentResultMatchers().string(Matchers.equalTo("bogus")).match(getStubMvcResult());
}
@@ -73,7 +73,7 @@ public class ContentResultMatchersTests {
new ContentResultMatchers().bytes(CONTENT.getBytes("UTF-8")).match(getStubMvcResult());
}
@Test(expected=AssertionError.class)
@Test(expected = AssertionError.class)
public void bytesNoMatch() throws Exception {
new ContentResultMatchers().bytes("bogus".getBytes()).match(getStubMvcResult());
}
@@ -90,12 +90,12 @@ public class ContentResultMatchersTests {
new ContentResultMatchers().json("{\n \"foo array\":[\"foo\",\"bar\"], \"foo\":\"bar\" \n}", true).match(getStubMvcResult());
}
@Test(expected=AssertionError.class)
@Test(expected = AssertionError.class)
public void jsonLenientNoMatch() throws Exception {
new ContentResultMatchers().json("{\n\"fooo\":\"bar\"\n}").match(getStubMvcResult());
}
@Test(expected=AssertionError.class)
@Test(expected = AssertionError.class)
public void jsonStrictNoMatch() throws Exception {
new ContentResultMatchers().json("{\"foo\":\"bar\", \"foo array\":[\"bar\",\"foo\"]}", true).match(getStubMvcResult());
}

View File

@@ -31,7 +31,7 @@ public class FlashAttributeResultMatchersTests {
new FlashAttributeResultMatchers().attributeExists("good").match(getStubMvcResult());
}
@Test(expected=AssertionError.class)
@Test(expected = AssertionError.class)
public void attributeExists_doesntExist() throws Exception {
new FlashAttributeResultMatchers().attributeExists("bad").match(getStubMvcResult());
}
@@ -41,7 +41,7 @@ public class FlashAttributeResultMatchersTests {
new FlashAttributeResultMatchers().attribute("good", "good").match(getStubMvcResult());
}
@Test(expected=AssertionError.class)
@Test(expected = AssertionError.class)
public void attribute_incorrectValue() throws Exception {
new FlashAttributeResultMatchers().attribute("good", "not good").match(getStubMvcResult());
}

View File

@@ -68,7 +68,7 @@ public class ModelResultMatchersTests {
this.matchers.attributeExists("good").match(this.mvcResult);
}
@Test(expected=AssertionError.class)
@Test(expected = AssertionError.class)
public void attributeExists_doesNotExist() throws Exception {
this.matchers.attributeExists("bad").match(this.mvcResult);
}
@@ -78,7 +78,7 @@ public class ModelResultMatchersTests {
this.matchers.attributeDoesNotExist("bad").match(this.mvcResult);
}
@Test(expected=AssertionError.class)
@Test(expected = AssertionError.class)
public void attributeDoesNotExist_doesExist() throws Exception {
this.matchers.attributeDoesNotExist("good").match(this.mvcResultWithError);
}
@@ -88,7 +88,7 @@ public class ModelResultMatchersTests {
this.matchers.attribute("good", is("good")).match(this.mvcResult);
}
@Test(expected=AssertionError.class)
@Test(expected = AssertionError.class)
public void attribute_notEqual() throws Exception {
this.matchers.attribute("good", is("bad")).match(this.mvcResult);
}
@@ -98,7 +98,7 @@ public class ModelResultMatchersTests {
this.matchers.hasNoErrors().match(this.mvcResult);
}
@Test(expected=AssertionError.class)
@Test(expected = AssertionError.class)
public void hasNoErrors_withErrors() throws Exception {
this.matchers.hasNoErrors().match(this.mvcResultWithError);
}
@@ -108,7 +108,7 @@ public class ModelResultMatchersTests {
this.matchers.attributeHasErrors("date").match(this.mvcResultWithError);
}
@Test(expected=AssertionError.class)
@Test(expected = AssertionError.class)
public void attributeHasErrors_withoutErrors() throws Exception {
this.matchers.attributeHasErrors("good").match(this.mvcResultWithError);
}
@@ -118,12 +118,12 @@ public class ModelResultMatchersTests {
this.matchers.attributeHasNoErrors("good").match(this.mvcResult);
}
@Test(expected=AssertionError.class)
@Test(expected = AssertionError.class)
public void attributeHasNoErrors_withoutAttribute() throws Exception {
this.matchers.attributeHasNoErrors("missing").match(this.mvcResultWithError);
}
@Test(expected=AssertionError.class)
@Test(expected = AssertionError.class)
public void attributeHasNoErrors_withErrors() throws Exception {
this.matchers.attributeHasNoErrors("date").match(this.mvcResultWithError);
}
@@ -133,17 +133,17 @@ public class ModelResultMatchersTests {
this.matchers.attributeHasFieldErrors("date", "time").match(this.mvcResultWithError);
}
@Test(expected=AssertionError.class)
@Test(expected = AssertionError.class)
public void attributeHasFieldErrors_withoutAttribute() throws Exception {
this.matchers.attributeHasFieldErrors("missing", "bad").match(this.mvcResult);
}
@Test(expected=AssertionError.class)
@Test(expected = AssertionError.class)
public void attributeHasFieldErrors_withoutErrorsForAttribute() throws Exception {
this.matchers.attributeHasFieldErrors("date", "time").match(this.mvcResult);
}
@Test(expected=AssertionError.class)
@Test(expected = AssertionError.class)
public void attributeHasFieldErrors_withoutErrorsForField() throws Exception {
this.matchers.attributeHasFieldErrors("date", "good", "time").match(this.mvcResultWithError);
}