@Test @DisplayName("throw exceptions with suppressed throwables") void throwWithSuppressed() { DeliveryErrors.Builder builder = DeliveryErrors.newBuilder(); ModelError mockError = new ModelError("model is wrong"); ModelError anotherMockError = new ModelError("completely"); RuntimeException mockException = new IllegalArgumentException("3.14"); builder.addError(mockError); builder.addError(anotherMockError); builder.addException(mockException); DeliveryErrors errors = builder.build(); ModelError error = assertThrows(ModelError.class, errors::throwIfAny); assertThat(error) .isEqualTo(mockError); assertThat(error.getSuppressed()) .asList() .containsExactly(anotherMockError, mockException); }
public static Builder newBuilder() { return new Builder(); }
DeliveryErrors { public static Builder newBuilder() { return new Builder(); } }
DeliveryErrors { public static Builder newBuilder() { return new Builder(); } private  DeliveryErrors(Builder builder); }
DeliveryErrors { public static Builder newBuilder() { return new Builder(); } private  DeliveryErrors(Builder builder); static Builder newBuilder(); }
DeliveryErrors { public static Builder newBuilder() { return new Builder(); } private  DeliveryErrors(Builder builder); static Builder newBuilder();  }