From d276d9ca0d23be39f94a548965028c36c69ecaca Mon Sep 17 00:00:00 2001 From: yirutang Date: Tue, 2 Mar 2021 13:09:49 -0800 Subject: [PATCH] fix one more test --- .../storage/v1beta2/StreamWriterTest.java | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1beta2/StreamWriterTest.java b/google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1beta2/StreamWriterTest.java index 723ba393f6..e6e006af63 100644 --- a/google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1beta2/StreamWriterTest.java +++ b/google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1beta2/StreamWriterTest.java @@ -471,19 +471,23 @@ public void testBatchIsFlushedWithError() throws Exception { .build()); ApiFuture appendFuture1 = sendTestMessage(writer, new String[] {"A"}); - ApiFuture appendFuture2 = sendTestMessage(writer, new String[] {"B"}); - ApiFuture appendFuture3 = sendTestMessage(writer, new String[] {"C"}); - try { - appendFuture2.get(); - } catch (ExecutionException ex) { - assertEquals(DataLossException.class, ex.getCause().getClass()); - } - assertFalse(appendFuture3.isDone()); - writer.shutdown(); try { - appendFuture3.get(); - } catch (ExecutionException ex) { - assertEquals(AbortedException.class, ex.getCause().getClass()); + ApiFuture appendFuture2 = sendTestMessage(writer, new String[]{"B"}); + ApiFuture appendFuture3 = sendTestMessage(writer, new String[]{"C"}); + try { + appendFuture2.get(); + } catch (ExecutionException ex) { + assertEquals(DataLossException.class, ex.getCause().getClass()); + } + assertFalse(appendFuture3.isDone()); + writer.shutdown(); + try { + appendFuture3.get(); + } catch (ExecutionException ex) { + assertEquals(AbortedException.class, ex.getCause().getClass()); + } + } catch (IllegalStateException ex) { + assertEquals("Stream already failed.", ex.getMessage()); } } }