Skip to content

Polish StringOrBytesSerializer #3933

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

ngocnhan-tran1996
Copy link
Contributor

This PR includes

  • Use pattern matching
  • Reduce else-if condition

Signed-off-by: Tran Ngoc Nhan <[email protected]>
@@ -51,6 +53,9 @@ void test() {
Map<String, Object> configs = Collections.singletonMap("serializer.encoding", "UTF-16");
serializer.configure(configs, false);
assertThat(KafkaTestUtils.getPropertyValue(serializer, "stringSerializer.encoding")).isEqualTo(StandardCharsets.UTF_16);
assertThat(serializer.serialize("null", null)).isNull();
assertThatExceptionOfType(IllegalStateException.class).isThrownBy(() -> serializer.serialize("ex", 0))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a dedicated assertThatIllegalStateException() factory method:

Suggested change
assertThatExceptionOfType(IllegalStateException.class).isThrownBy(() -> serializer.serialize("ex", 0))
assertThatIllegalStateException().isThrownBy(() -> serializer.serialize("ex", 0))

@artembilan artembilan added this to the 4.0.0-M3 milestone May 30, 2025
@artembilan artembilan merged commit 80af49e into spring-projects:main Jun 2, 2025
3 checks passed
@ngocnhan-tran1996 ngocnhan-tran1996 deleted the polish-stringorbytesserializer branch June 3, 2025 04:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants