Skip to content

Commit 053294d

Browse files
committed
test: add unit tests for UpdateQueryParams to validate creation, equality, and string representation
1 parent d4fabe8 commit 053294d

File tree

1 file changed

+39
-1
lines changed
  • jnosql-communication/jnosql-communication-semistructured/src/test/java/org/eclipse/jnosql/communication/semistructured

1 file changed

+39
-1
lines changed

jnosql-communication/jnosql-communication-semistructured/src/test/java/org/eclipse/jnosql/communication/semistructured/UpdateQueryParamsTest.java

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,46 @@
1111

1212
package org.eclipse.jnosql.communication.semistructured;
1313

14-
import static org.junit.jupiter.api.Assertions.*;
14+
import org.eclipse.jnosql.communication.Params;
15+
import org.junit.jupiter.api.Test;
16+
17+
import static org.assertj.core.api.Assertions.assertThat;
18+
import static org.mockito.Mockito.mock;
1519

1620
class UpdateQueryParamsTest {
1721

22+
@Test
23+
void shouldCreateUpdateQueryParams() {
24+
UpdateQuery updateQuery = mock(UpdateQuery.class);
25+
Params params = mock(Params.class);
26+
27+
UpdateQueryParams updateQueryParams = new UpdateQueryParams(updateQuery, params);
28+
29+
assertThat(updateQueryParams.updateQuery()).isSameAs(updateQuery);
30+
assertThat(updateQueryParams.params()).isSameAs(params);
31+
}
32+
33+
@Test
34+
void shouldImplementEqualsAndHashCode() {
35+
UpdateQuery updateQuery = mock(UpdateQuery.class);
36+
Params params = mock(Params.class);
37+
38+
UpdateQueryParams first = new UpdateQueryParams(updateQuery, params);
39+
UpdateQueryParams second = new UpdateQueryParams(updateQuery, params);
40+
41+
assertThat(first).isEqualTo(second);
42+
assertThat(first).hasSameHashCodeAs(second);
43+
}
44+
45+
@Test
46+
void shouldHaveToStringRepresentation() {
47+
UpdateQuery updateQuery = mock(UpdateQuery.class);
48+
Params params = mock(Params.class);
49+
50+
UpdateQueryParams updateQueryParams = new UpdateQueryParams(updateQuery, params);
51+
52+
assertThat(updateQueryParams.toString())
53+
.contains("updateQuery=")
54+
.contains("params=");
55+
}
1856
}

0 commit comments

Comments
 (0)