Skip to content

Commit

Permalink
GH-1550: Polish test
Browse files Browse the repository at this point in the history
  • Loading branch information
garyrussell committed Jul 29, 2020
1 parent b215ca4 commit dee102f
Showing 1 changed file with 4 additions and 3 deletions.
Expand Up @@ -84,7 +84,8 @@ void testTrustedAndNot() {
.build();
RecordHeaders recordHeaders = new RecordHeaders();
mapper.fromHeaders(message.getHeaders(), recordHeaders);
assertThat(recordHeaders.toArray().length).isEqualTo(23); // 21 + json_types
int expectedSize = message.getHeaders().size() - 3; // ID, Timestamp, reply channel
assertThat(recordHeaders.toArray().length).isEqualTo(expectedSize + 1); // json_types header
Map<String, Object> headers = new HashMap<>();
mapper.toHeaders(recordHeaders, headers);
assertThat(headers.get("foo")).isInstanceOf(byte[].class);
Expand Down Expand Up @@ -112,7 +113,7 @@ void testTrustedAndNot() {
NonTrustedHeaderType ntht = (NonTrustedHeaderType) headers.get("fix");
assertThat(ntht.getHeaderValue()).isNotNull();
assertThat(ntht.getUntrustedType()).isEqualTo(Foo.class.getName());
assertThat(headers).hasSize(22);
assertThat(headers).hasSize(expectedSize);

mapper.addTrustedPackages(getClass().getPackage().getName());
headers = new HashMap<>();
Expand All @@ -121,7 +122,7 @@ void testTrustedAndNot() {
assertThat(new String((byte[]) headers.get("foo"))).isEqualTo("bar");
assertThat(headers.get("baz")).isEqualTo("qux");
assertThat(headers.get("fix")).isEqualTo(new Foo());
assertThat(headers).hasSize(22);
assertThat(headers).hasSize(expectedSize);
}

@Test
Expand Down

0 comments on commit dee102f

Please sign in to comment.