|
2 | 2 | */
|
3 | 3 | package org.hamcrest.beans;
|
4 | 4 |
|
5 |
| -import static org.hamcrest.beans.WithSamePropertyValuesAs.withSamePropertyValuesAs; |
| 5 | +import static org.hamcrest.beans.SamePropertyValuesAs.samePropertyValuesAs; |
6 | 6 |
|
7 | 7 | import org.hamcrest.AbstractMatcherTest;
|
8 | 8 | import org.hamcrest.Matcher;
|
9 | 9 |
|
10 |
| -public class WithSamePropertyValuesAsTest extends AbstractMatcherTest { |
| 10 | +public class SamePropertyValuesAsTest extends AbstractMatcherTest { |
11 | 11 | private static final Value aValue = new Value("expected");
|
12 | 12 | private static final ExampleBean expectedBean = new ExampleBean("same", 1, aValue);
|
13 | 13 | private static final ExampleBean actualBean = new ExampleBean("same", 1, aValue);
|
14 | 14 |
|
15 | 15 |
|
16 | 16 | @Override
|
17 | 17 | protected Matcher<?> createMatcher() {
|
18 |
| - return withSamePropertyValuesAs(expectedBean); |
| 18 | + return samePropertyValuesAs(expectedBean); |
19 | 19 | }
|
20 | 20 |
|
21 | 21 | public void testReportsMatchWhenAllPropertiesMatch() {
|
22 |
| - assertMatches("matched properties", withSamePropertyValuesAs(expectedBean), actualBean); |
| 22 | + assertMatches("matched properties", samePropertyValuesAs(expectedBean), actualBean); |
23 | 23 | }
|
24 | 24 |
|
25 | 25 | public void testReportsMismatchWhenActualTypeIsNotAssignableToExpectedType() {
|
26 | 26 | assertMismatchDescription("is incompatible type: ExampleBean",
|
27 |
| - withSamePropertyValuesAs((Object)aValue), actualBean); |
| 27 | + samePropertyValuesAs((Object)aValue), actualBean); |
28 | 28 | }
|
29 | 29 |
|
30 | 30 | public void testReportsMisatchOnFirstPropertyDifference() {
|
31 | 31 | assertMismatchDescription("string was \"different\"",
|
32 |
| - withSamePropertyValuesAs(expectedBean), new ExampleBean("different", 1, aValue)); |
| 32 | + samePropertyValuesAs(expectedBean), new ExampleBean("different", 1, aValue)); |
33 | 33 | assertMismatchDescription("int was <2>",
|
34 |
| - withSamePropertyValuesAs(expectedBean), new ExampleBean("same", 2, aValue)); |
| 34 | + samePropertyValuesAs(expectedBean), new ExampleBean("same", 2, aValue)); |
35 | 35 | assertMismatchDescription("value was <Value other>",
|
36 |
| - withSamePropertyValuesAs(expectedBean), new ExampleBean("same", 1, new Value("other"))); |
| 36 | + samePropertyValuesAs(expectedBean), new ExampleBean("same", 1, new Value("other"))); |
37 | 37 | }
|
38 | 38 |
|
39 | 39 | public void testMatchesBeansWithInheritanceButNoExtraProperties() {
|
40 | 40 | assertMatches("sub type with same properties",
|
41 |
| - withSamePropertyValuesAs(expectedBean), new SubBeanWithNoExtraProperties("same", 1, aValue)); |
| 41 | + samePropertyValuesAs(expectedBean), new SubBeanWithNoExtraProperties("same", 1, aValue)); |
42 | 42 | }
|
43 | 43 |
|
44 | 44 | public void testRejectsSubTypeThatHasExtraProperties() {
|
45 | 45 | assertMismatchDescription("has extra properties called [extra]",
|
46 |
| - withSamePropertyValuesAs(expectedBean), new SubBeanWithExtraProperty("same", 1, aValue)); |
| 46 | + samePropertyValuesAs(expectedBean), new SubBeanWithExtraProperty("same", 1, aValue)); |
47 | 47 | }
|
48 | 48 |
|
49 | 49 | public void testDescribesItself() {
|
50 |
| - assertDescription("with same property values as ExampleBean [int: <1>, string: \"same\", value: <Value expected>]", withSamePropertyValuesAs(expectedBean)); |
| 50 | + assertDescription("same property values as ExampleBean [int: <1>, string: \"same\", value: <Value expected>]", samePropertyValuesAs(expectedBean)); |
51 | 51 | }
|
52 | 52 |
|
53 | 53 | public static class Value {
|
|
0 commit comments