|
| 1 | +/* |
| 2 | + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with |
| 3 | + * the License. You may obtain a copy of the License at |
| 4 | + * |
| 5 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 6 | + * |
| 7 | + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on |
| 8 | + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| 9 | + * specific language governing permissions and limitations under the License. |
| 10 | + * |
| 11 | + * Copyright 2025-2025 the original author or authors. |
| 12 | + */ |
| 13 | +package org.assertj.eclipse.collections.api; |
| 14 | + |
| 15 | +import org.assertj.core.api.AbstractSoftAssertions; |
| 16 | +import org.assertj.core.api.SoftAssertionsProvider; |
| 17 | +import org.opentest4j.MultipleFailuresError; |
| 18 | + |
| 19 | +import java.util.function.Consumer; |
| 20 | + |
| 21 | +/** |
| 22 | + * A soft assertions provider for Eclipse Collections assertions |
| 23 | + */ |
| 24 | +public class SoftAssertions extends AbstractSoftAssertions implements EclipseCollectionsSoftAssertionsProvider { |
| 25 | + /** |
| 26 | + * Creates a new {@link SoftAssertions}. |
| 27 | + */ |
| 28 | + public SoftAssertions() { |
| 29 | + // Do nothing |
| 30 | + } |
| 31 | + |
| 32 | + /** |
| 33 | + * Convenience method for calling {@link EclipseCollectionsSoftAssertionsProvider#assertSoftly} for these assertion |
| 34 | + * types. Equivalent to {@code SoftAssertion.assertSoftly(SoftAssertions.class, softly)}. |
| 35 | + * |
| 36 | + * @param softly the Consumer containing the code that will make the soft assertions. |
| 37 | + * Takes one parameter (the SoftAssertions instance used to make the assertions). |
| 38 | + * @throws MultipleFailuresError if possible or SoftAssertionError if any proxied assertion objects threw an {@link |
| 39 | + * AssertionError} |
| 40 | + */ |
| 41 | + public static void assertSoftly(Consumer<SoftAssertions> softly) { |
| 42 | + SoftAssertionsProvider.assertSoftly(SoftAssertions.class, softly); |
| 43 | + } |
| 44 | +} |
0 commit comments