jiexray commented on code in PR #22445:
URL: https://github.com/apache/flink/pull/22445#discussion_r1175244442
##########
flink-queryable-state/flink-queryable-state-client-java/src/test/java/org/apache/flink/queryablestate/client/state/ImmutableListStateTest.java:
##########
@@ -56,26 +57,34 @@ public void setUp() throws Exception {
listState = ImmutableListState.createState(listStateDesc, serInit);
}
- @Test(expected = UnsupportedOperationException.class)
- public void testUpdate() throws Exception {
- List<Long> list = getStateContents();
- assertEquals(1L, list.size());
+ @Test
+ void testUpdate() {
+ assertThatThrownBy(
+ () -> {
+ List<Long> list = getStateContents();
+ assertEquals(1L, list.size());
- long element = list.get(0);
- assertEquals(42L, element);
+ long element = list.get(0);
+ assertEquals(42L, element);
- listState.add(54L);
+ listState.add(54L);
+ })
+ .isInstanceOf(UnsupportedOperationException.class);
}
- @Test(expected = UnsupportedOperationException.class)
- public void testClear() throws Exception {
- List<Long> list = getStateContents();
- assertEquals(1L, list.size());
+ @Test
+ void testClear() {
+ assertThatThrownBy(
+ () -> {
+ List<Long> list = getStateContents();
+ assertEquals(1L, list.size());
- long element = list.get(0);
- assertEquals(42L, element);
+ long element = list.get(0);
+ assertEquals(42L, element);
Review Comment:
better use `assertThat(list).contains(42L, Index.atIndex(0));`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]