@Test public void parseInvalid() throws Exception { InputStream is = new ByteArrayInputStream(new byte[] {-127}); try { marshaller.parse(is); fail("Expected exception"); } catch (StatusRuntimeException ex) { assertEquals(Status.Code.INTERNAL, ex.getStatus().getCode()); assertTrue(ex.getCause() instanceof TException); } }
@Test @SuppressWarnings("ThrowableResultOfMethodCallIgnored") public void create_invalid_argument_status_exception() { final IllegalArgumentException exception = new IllegalArgumentException(""); final StatusRuntimeException statusRuntimeException = Statuses.invalidArgumentWithCause(exception); assertEquals(exception, statusRuntimeException.getCause()); assertEquals(Status.INVALID_ARGUMENT.getCode(), statusRuntimeException.getStatus().getCode()); }