RFR: 8367439: Bulk change notifications for ObservableSet and ObservableMap [v3]
Andy Goryachev
angorya at openjdk.org
Fri Oct 24 18:16:22 UTC 2025
On Fri, 24 Oct 2025 00:01:30 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:
>> modules/javafx.base/src/test/java/test/com/sun/javafx/collections/ObservableMapWrapperTest.java line 78:
>>
>>> 76: "d added at key k4",
>>> 77: "e added at key k5",
>>> 78: "f added at key k6"),
>>
>> this is confusing (to me): I don't see the boundary created by the next() call (i.e. between the bulk and individual changes)
>>
>> or am I missing something?
>
> This test demonstrates that the sequence of changes is the same, no matter the number of change listener invocations. For this purpose, we assert that the number of changes is as expected (6), but the number of invocations is only 3. In this sense, not seeing a boundary between the invocations is the point.
Ok, so if I were to write a test per the public API, two things should be tested: the changes and the bulk aspect. So perhaps the toString() or the test's toString() can be modified to explicitly encode the bulk aspect. In other words, the test might look like this:
expect([k3=c, k4=d],[k5=e],[k6=f])
if the test calls next on k3 and k4, then individual events come for k5, k6.
This way you test both API functions in one test.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1885#discussion_r2461505224
More information about the openjfx-dev
mailing list