Skip to content

Conversation

@AKakkar28
Copy link
Contributor

This PR fixes an encapsulation issue in TopicPartitionVO#getReplicas() by returning an unmodifiable collection instead of exposing the internal LinkedHashMap.values().

Changes:
Wrapped replicas.values() with Collections.unmodifiableCollection.
Added TopicPartitionVOTest to verify that external mutation attempts throw UnsupportedOperationException.

Also, added JUnit Test for this TopicPartitionVOTest.java
@AKakkar28
Copy link
Contributor Author

@Bert-R I have created this PR.
Its a very small change and I have a test to verify it as well.
Can you please review and merge?
Thanks

@AKakkar28
Copy link
Contributor Author

Hi @Bert-R @davideicardi
Can someone plz review this PR and merge it thanks?

@Bert-R
Copy link
Collaborator

Bert-R commented Sep 25, 2025

We will, when we get to it

…and improve unit test coverage for TopicVO and ConsumerPartitionVO
@AKakkar28
Copy link
Contributor Author

@davideicardi I have added another commit it is fairly simple. I added null-safety to constructors and setters and also unit tests for TopicVO and ConsumerPartitionVO.
Can you please review this thanks a lot?

@Bert-R
Copy link
Collaborator

Bert-R commented Sep 26, 2025

@AKakkar28 Please revert the last commit. There are better ways to improve the maintainability of these value objects.

… create and improve unit test coverage for TopicVO and ConsumerPartitionVO"

This reverts commit f126caf.
@AKakkar28
Copy link
Contributor Author

@Bert-R Done. Should I add JUnit test for other model classes to ensure correct behavior?

@Bert-R Bert-R merged commit 137624f into obsidiandynamics:master Sep 26, 2025
1 check passed
@Bert-R
Copy link
Collaborator

Bert-R commented Sep 26, 2025

I just merged this PR. Thanks for the contribution!

@Bert-R Done. Should I add JUnit test for other model classes to ensure correct behavior?
I don't think that adds a lot of value right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants