Skip to content

Commit 9a95682

Browse files
committed
Fixing an incorrect assumption in one of the tests and updating the travis yaml file.
1 parent 7c3ba62 commit 9a95682

File tree

4 files changed

+5
-54
lines changed

4 files changed

+5
-54
lines changed

.travis.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
sudo: false
22
language: java
33

4-
jdk:
5-
- oraclejdk8
6-
7-
addons:
8-
apt:
9-
packages:
10-
- oracle-java8-installer
11-
124
install:
135
- mvn clean install -DskipTests
146
script:
@@ -20,4 +12,3 @@ notifications:
2012
branches:
2113
only:
2214
- master
23-

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ For instance, if you write a new class that overrides the `equals` method but fo
1616
<dependency>
1717
<groupId>com.redfin</groupId>
1818
<artifactId>contractual</artifactId>
19-
<version>2.1.0</version>
19+
<version>2.1.1</version>
2020
<scope>test</scope>
2121
</dependency>
2222
```

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<groupId>com.redfin</groupId>
1010
<artifactId>contractual</artifactId>
11-
<version>2.1.0</version>
11+
<version>2.1.1</version>
1212
<modelVersion>4.0.0</modelVersion>
1313
<packaging>jar</packaging>
1414

src/main/java/com/redfin/contractual/EqualsContract.java

Lines changed: 3 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -34,48 +34,8 @@
3434
* <br>
3535
* Note that the equals method is not friendly with regards to inheritance.
3636
* This contract makes a best effort to ensure the equality contracts with
37-
* regards to other instances of the same class but cannot ensure it up or
38-
* down the inheritance hierarchy. An example that breaks the symmetrical
39-
* portion of the equality contract in a way unable to be tested by this test
40-
* contract:
41-
* <br>
42-
* <pre>
43-
* <code>
44-
* public class A {
45-
* private final int i;
46-
*
47-
* public A(int i) {
48-
* this.i = i;
49-
* }
50-
*
51-
* {@literal @}Override
52-
* public boolean equals(Object obj) {
53-
* return obj instanceof A {@literal &&} i == ((A) obj).i;
54-
* }
55-
* }
56-
*
57-
* public class B extends A {
58-
* private final int i;
59-
*
60-
* public B(int i, int j) {
61-
* super(i);
62-
* this.j = j;
63-
* }
64-
*
65-
* {@literal @}Override
66-
* public boolean equals(Object obj) {
67-
* return obj instanceof B {@literal &&} super.equals(obj) {@literal &&} j == ((B) obj).j;
68-
* }
69-
* }
70-
*
71-
* public void testSymmetricEquality() {
72-
* A a = new A(1);
73-
* B b = new B(1, 2);
74-
* a.equals(b); // true
75-
* b.equals(a); // false
76-
* }
77-
* </code>
78-
* </pre>
37+
* regards to other instances of the same class but cannot ensure it if
38+
* superclasses break one or more of the equality contracts.
7939
*
8040
* @param <T> the class that is being tested.
8141
*/
@@ -188,7 +148,7 @@ default void testSymmetryOfEqualObjects() {
188148
.isNotNull();
189149
assumes().withMessage("This test requires that 'a' be equal to 'b'")
190150
.that(a)
191-
.isNotEqualTo(b);
151+
.isEqualTo(b);
192152
assumes().withMessage("This test requires that 'a' and 'b' be different instances")
193153
.that(a == b)
194154
.isFalse();

0 commit comments

Comments
 (0)