This commit is contained in:
Phillip Webb
2016-09-02 09:33:00 +01:00
parent b5294a48b2
commit 41dc53f5dd
10 changed files with 46 additions and 57 deletions

View File

@@ -25,7 +25,7 @@ import java.util.List;
*
* @author Andy Wilkinson
*/
public class MockitoBeans implements Iterable<Object> {
class MockitoBeans implements Iterable<Object> {
private final List<Object> beans = new ArrayList<Object>();

View File

@@ -37,9 +37,9 @@ import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriTemplateHandler;
/**
* {@link RequestExpectationManager} that strips the specified root URI from the
* request before verification. Can be used to simply test declarations when all REST
* calls start the same way. For example: <pre class="code">
* {@link RequestExpectationManager} that strips the specified root URI from the request
* before verification. Can be used to simply test declarations when all REST calls start
* the same way. For example: <pre class="code">
* RestTemplate restTemplate = new RestTemplateBuilder().rootUri("http://example.com").build();
* MockRestServiceServer server = RootUriRequestExpectationManager.bindTo(restTemplate);
* server.expect(requestTo("/hello")).andRespond(withSuccess());

View File

@@ -384,29 +384,25 @@ public class JsonContentAssertTests {
@Test
public void isEqualToJsonWhenStringIsMatchingAndComparatorShouldPass()
throws Exception {
assertThat(forJson(SOURCE)).isEqualToJson(LENIENT_SAME,
COMPARATOR);
assertThat(forJson(SOURCE)).isEqualToJson(LENIENT_SAME, COMPARATOR);
}
@Test(expected = AssertionError.class)
public void isEqualToJsonWhenStringIsNotMatchingAndComparatorShouldFail()
throws Exception {
assertThat(forJson(SOURCE)).isEqualToJson(DIFFERENT,
COMPARATOR);
assertThat(forJson(SOURCE)).isEqualToJson(DIFFERENT, COMPARATOR);
}
@Test
public void isEqualToJsonWhenResourcePathIsMatchingAndComparatorShouldPass()
throws Exception {
assertThat(forJson(SOURCE)).isEqualToJson("lenient-same.json",
COMPARATOR);
assertThat(forJson(SOURCE)).isEqualToJson("lenient-same.json", COMPARATOR);
}
@Test(expected = AssertionError.class)
public void isEqualToJsonWhenResourcePathIsNotMatchingAndComparatorShouldFail()
throws Exception {
assertThat(forJson(SOURCE)).isEqualToJson("different.json",
COMPARATOR);
assertThat(forJson(SOURCE)).isEqualToJson("different.json", COMPARATOR);
}
@Test
@@ -426,29 +422,25 @@ public class JsonContentAssertTests {
@Test
public void isEqualToJsonWhenBytesAreMatchingAndComparatorShouldPass()
throws Exception {
assertThat(forJson(SOURCE)).isEqualToJson(LENIENT_SAME.getBytes(),
COMPARATOR);
assertThat(forJson(SOURCE)).isEqualToJson(LENIENT_SAME.getBytes(), COMPARATOR);
}
@Test(expected = AssertionError.class)
public void isEqualToJsonWhenBytesAreNotMatchingAndComparatorShouldFail()
throws Exception {
assertThat(forJson(SOURCE)).isEqualToJson(DIFFERENT.getBytes(),
COMPARATOR);
assertThat(forJson(SOURCE)).isEqualToJson(DIFFERENT.getBytes(), COMPARATOR);
}
@Test
public void isEqualToJsonWhenFileIsMatchingAndComparatorShouldPass()
throws Exception {
assertThat(forJson(SOURCE)).isEqualToJson(createFile(LENIENT_SAME),
COMPARATOR);
assertThat(forJson(SOURCE)).isEqualToJson(createFile(LENIENT_SAME), COMPARATOR);
}
@Test(expected = AssertionError.class)
public void isEqualToJsonWhenFileIsNotMatchingAndComparatorShouldFail()
throws Exception {
assertThat(forJson(SOURCE)).isEqualToJson(createFile(DIFFERENT),
COMPARATOR);
assertThat(forJson(SOURCE)).isEqualToJson(createFile(DIFFERENT), COMPARATOR);
}
@Test
@@ -475,8 +467,7 @@ public class JsonContentAssertTests {
@Test(expected = AssertionError.class)
public void isEqualToJsonWhenResourceIsNotMatchingAndComparatorShouldFail()
throws Exception {
assertThat(forJson(SOURCE)).isEqualToJson(createResource(DIFFERENT),
COMPARATOR);
assertThat(forJson(SOURCE)).isEqualToJson(createResource(DIFFERENT), COMPARATOR);
}
@Test(expected = AssertionError.class)
@@ -809,29 +800,25 @@ public class JsonContentAssertTests {
@Test(expected = AssertionError.class)
public void isNotEqualToJsonWhenStringIsMatchingAndComparatorShouldFail()
throws Exception {
assertThat(forJson(SOURCE)).isNotEqualToJson(LENIENT_SAME,
COMPARATOR);
assertThat(forJson(SOURCE)).isNotEqualToJson(LENIENT_SAME, COMPARATOR);
}
@Test
public void isNotEqualToJsonWhenStringIsNotMatchingAndComparatorShouldPass()
throws Exception {
assertThat(forJson(SOURCE)).isNotEqualToJson(DIFFERENT,
COMPARATOR);
assertThat(forJson(SOURCE)).isNotEqualToJson(DIFFERENT, COMPARATOR);
}
@Test(expected = AssertionError.class)
public void isNotEqualToJsonWhenResourcePathIsMatchingAndComparatorShouldFail()
throws Exception {
assertThat(forJson(SOURCE)).isNotEqualToJson("lenient-same.json",
COMPARATOR);
assertThat(forJson(SOURCE)).isNotEqualToJson("lenient-same.json", COMPARATOR);
}
@Test
public void isNotEqualToJsonWhenResourcePathIsNotMatchingAndComparatorShouldPass()
throws Exception {
assertThat(forJson(SOURCE)).isNotEqualToJson("different.json",
COMPARATOR);
assertThat(forJson(SOURCE)).isNotEqualToJson("different.json", COMPARATOR);
}
@Test(expected = AssertionError.class)
@@ -851,15 +838,13 @@ public class JsonContentAssertTests {
@Test(expected = AssertionError.class)
public void isNotEqualToJsonWhenBytesAreMatchingAndComparatorShouldFail()
throws Exception {
assertThat(forJson(SOURCE)).isNotEqualToJson(LENIENT_SAME.getBytes(),
COMPARATOR);
assertThat(forJson(SOURCE)).isNotEqualToJson(LENIENT_SAME.getBytes(), COMPARATOR);
}
@Test
public void isNotEqualToJsonWhenBytesAreNotMatchingAndComparatorShouldPass()
throws Exception {
assertThat(forJson(SOURCE)).isNotEqualToJson(DIFFERENT.getBytes(),
COMPARATOR);
assertThat(forJson(SOURCE)).isNotEqualToJson(DIFFERENT.getBytes(), COMPARATOR);
}
@Test(expected = AssertionError.class)
@@ -872,8 +857,7 @@ public class JsonContentAssertTests {
@Test
public void isNotEqualToJsonWhenFileIsNotMatchingAndComparatorShouldPass()
throws Exception {
assertThat(forJson(SOURCE)).isNotEqualToJson(createFile(DIFFERENT),
COMPARATOR);
assertThat(forJson(SOURCE)).isNotEqualToJson(createFile(DIFFERENT), COMPARATOR);
}
@Test(expected = AssertionError.class)