5
5
6
6
import java .util .ArrayList ;
7
7
import java .util .Collections ;
8
+ import java .util .HashMap ;
8
9
import java .util .HashSet ;
9
10
import java .util .List ;
10
11
import java .util .Map ;
@@ -258,18 +259,34 @@ public void topicInfoShouldNotAcceptNulls() {
258
259
}
259
260
260
261
@ Test
261
- public void topicInfoShouldNotBeModifiable () {
262
- final StreamsRebalanceData .TopicInfo topicInfo = new StreamsRebalanceData .TopicInfo (
263
- Optional .of (1 ),
264
- Optional .of ((short ) 1 ),
265
- Map .of ("key1" , "value1" )
266
- .entrySet ().stream ()
267
- .collect (Collectors .toMap (Map .Entry ::getKey , Map .Entry ::getValue ))
268
- );
262
+ public void streamsRebalanceDataShouldNotHaveModifiableSubtopologies () {
263
+ final StreamsRebalanceData streamsRebalanceData = new StreamsRebalanceData (new HashMap <>());
269
264
270
265
assertThrows (
271
266
UnsupportedOperationException .class ,
272
- () -> topicInfo .topicConfigs ().put ("key2" , "value2" )
267
+ () -> streamsRebalanceData .subtopologies ().put ("subtopologyId2" , new StreamsRebalanceData .Subtopology (
268
+ Set .of (),
269
+ Set .of (),
270
+ Map .of (),
271
+ Map .of (),
272
+ List .of ()
273
+ ))
273
274
);
274
275
}
275
- }
276
+
277
+ @ Test
278
+ public void streamsRebalanceDataShouldNotAcceptNulls () {
279
+ final Exception exception = assertThrows (
280
+ NullPointerException .class ,
281
+ () -> new StreamsRebalanceData (null )
282
+ );
283
+ assertEquals ("Subtopologies cannot be null" , exception .getMessage ());
284
+ }
285
+
286
+ @ Test
287
+ public void streamsRebalanceDataShouldBeConstructedWithEmptyAssignment () {
288
+ final StreamsRebalanceData streamsRebalanceData = new StreamsRebalanceData (new HashMap <>());
289
+
290
+ assertEquals (StreamsRebalanceData .Assignment .EMPTY , streamsRebalanceData .reconciledAssignment ());
291
+ }
292
+ }
0 commit comments