Skip to content

Commit

Permalink
Add equals with HttpHeaderGetters and endOfStream test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
injae-kim committed Mar 9, 2024
1 parent d291c12 commit bb5ef93
Showing 1 changed file with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,34 @@ void equals_true() {
other2.add("dup", "dup1");
other2.add("dup", "dup2");
assertThat(headers.equals(other2)).isTrue();

final HttpHeaders other3 = HttpHeaders.builder()
.add("k1", "v1")
.add("k2", "v2")
.add("k3", "v3")
.add("k4", "v4")
.add("k5", "v5")
.add("k6", "v6")
.add("dup", "dup1")
.add("dup", "dup2")
.build();
assertThat(headers.equals(other3)).isTrue();

final CompositeHttpHeadersBase headersEndOfStream =
new CompositeHttpHeadersBase(HttpHeaders.of(),
HttpHeaders.of("k1", "v1")
.toBuilder()
.endOfStream(true).
build(),
HttpHeaders.of("k2", "v2",
"k3", "v3"));
final HttpHeaders other4 = HttpHeaders.builder()
.add("k1", "v1")
.add("k2", "v2")
.add("k3", "v3")
.endOfStream(true)
.build();
assertThat(headersEndOfStream.equals(other4)).isTrue();
}

@Test
Expand Down Expand Up @@ -325,6 +353,17 @@ void equals_false() {
HttpHeaders.of());
other2.endOfStream(true);
assertThat(headers.equals(other2)).isFalse();

final HttpHeaders other3 = HttpHeaders.of("k1", "v1");
assertThat(headers.equals(other3)).isFalse();

final HttpHeaders other4 = HttpHeaders.builder()
.add("k1", "v1")
.add("k2", "v2")
.add("k3", "v3")
.endOfStream(true)
.build();
assertThat(headers.equals(other4)).isFalse();
}

@Test
Expand Down

0 comments on commit bb5ef93

Please sign in to comment.