Skip to content

Commit 625c7dd

Browse files
committed
Simply matcher and usert assertTrue
1 parent 436cf2e commit 625c7dd

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

google-cloud-spanner/src/test/java/com/google/cloud/spanner/OpenTelemetrySpanTest.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import static org.junit.Assert.assertEquals;
2020
import static org.junit.Assert.assertFalse;
21-
import static org.junit.Assert.assertNotNull;
2221
import static org.junit.Assert.assertThrows;
2322
import static org.junit.Assert.assertTrue;
2423

@@ -754,12 +753,8 @@ public void testTransactionRunnerWithRetryOnBeginTransaction() {
754753

755754
private void verifyAtLeast1SpanHasXGoogSpannerRequestIdAttribute(List<SpanData> finishedSpans) {
756755
AttributeKey<String> attributeKey = AttributeKey.stringKey("x_goog_spanner_request_id");
757-
SpanData matchedSpan =
758-
finishedSpans.stream()
759-
.filter(span -> !span.getAttributes().get(attributeKey).isEmpty())
760-
.findAny()
761-
.orElseThrow(IllegalStateException::new);
762-
assertNotNull(matchedSpan);
756+
assertTrue(
757+
finishedSpans.stream().anyMatch(span -> !span.getAttributes().get(attributeKey).isEmpty()));
763758
}
764759

765760
@Test

0 commit comments

Comments
 (0)