nastra commented on code in PR #3617:
URL: https://github.com/apache/parquet-java/pull/3617#discussion_r3441375760
##########
parquet-variant/src/test/java/org/apache/parquet/variant/TestVariantArray.java:
##########
@@ -171,13 +171,10 @@ public void testArrayFourByteOffset() {
@Test
public void testInvalidArray() {
- try {
- // An object header
- Variant value = new Variant(ByteBuffer.wrap(new byte[] {0b1000010}),
VariantTestUtil.EMPTY_METADATA);
- value.numArrayElements();
- Assert.fail("Expected exception not thrown");
- } catch (Exception e) {
- Assert.assertEquals("Cannot read OBJECT value as ARRAY", e.getMessage());
- }
+ // An object header
+ Variant value = new Variant(ByteBuffer.wrap(new byte[] {0b1000010}),
VariantTestUtil.EMPTY_METADATA);
+ assertThatThrownBy(value::numArrayElements)
Review Comment:
Previously with `Assert.fail` we would have a larger block where it wasn't
clear code line of code would actually throw the exception and what error msg
would be returned. We're more explicit now in terms of testing error
conditions, because we check the underlying exception and the error msg.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]