Skip to content

Commit d32abbd

Browse files
committed
Added a QueryTest.
1 parent 546f003 commit d32abbd

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package org.influxdb.dto;
2+
3+
import static org.assertj.core.api.Assertions.assertThat;
4+
5+
import org.testng.annotations.Test;
6+
7+
/**
8+
* Test for the Query DTO.
9+
*
10+
* @author jord [at] moz.com
11+
*
12+
*/
13+
public class QueryTest {
14+
15+
/**
16+
* Test that equals does what it is supposed to do.
17+
*/
18+
@Test
19+
public void testEqualsAndHashCode() {
20+
String stringA0 = "thesame";
21+
String stringA1 = "thesame";
22+
String stringB0 = "notthesame";
23+
24+
Query queryA0 = new Query(stringA0, stringA0);
25+
Query queryA1 = new Query(stringA1, stringA1);
26+
Query queryB0 = new Query(stringA0, stringB0);
27+
Query queryC0 = new Query(stringB0, stringA0);
28+
29+
assertThat(queryA0).isEqualTo(queryA1);
30+
assertThat(queryA0).isNotEqualTo(queryB0);
31+
assertThat(queryB0).isNotEqualTo(queryC0);
32+
33+
assertThat(queryA0.hashCode()).isEqualTo(queryA1.hashCode());
34+
assertThat(queryA0.hashCode()).isNotEqualTo(queryB0.hashCode());
35+
}
36+
}

0 commit comments

Comments
 (0)