@@ -0,0 +1,3097 @@
+/*%0A * Copyright 2019, TeamDev. All rights reserved.%0A *%0A * Redistribution and use in source and/or binary forms, with or without%0A * modification, must retain the above copyright notice and the following%0A * disclaimer.%0A *%0A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS%0A * %22AS IS%22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT%0A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR%0A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT%0A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,%0A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT%0A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,%0A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY%0A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT%0A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE%0A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.%0A */%0A%0Apackage io.spine.testing;%0A%0Aimport com.google.common.truth.ExpectFailure.SimpleSubjectBuilderCallback;%0Aimport com.google.common.truth.Subject;%0A%0Aimport static com.google.common.truth.ExpectFailure.expectFailureAbout;%0Aimport static com.google.common.truth.Truth.assertAbout;%0A%0A/**%0A * An abstract base for custom %7B@link Subject%7D test suites.%0A *%0A * @param %3CS%3E%0A *         the type of the %7B@code Subject%7D%0A * @param %3CT%3E%0A *         the target type tested by the %7B@code Subject%7D%0A */%0Apublic abstract class SubjectTest%3CS extends Subject%3CS, T%3E, T%3E %7B%0A%0A    protected static final String EXPECTED = %22expected%22;%0A    protected static final String BUT_WAS = %22but was%22;%0A    protected static final String EXPECTED_NOT_TO_BE = %22expected not to be%22;%0A    protected static final String NULL = %22null%22;%0A%0A    protected abstract Subject.Factory%3CS, T%3E subjectFactory();%0A%0A    /**%0A     * Creates a subject under the test with the passed actual value.%0A     */%0A    protected S assertWithSubjectThat(T actual) %7B%0A        return assertAbout(subjectFactory()).that(actual);%0A    %7D%0A%0A    /**%0A     * Creates an %7B@code AssertionError%7D caused by the passed callback.%0A     *%0A     * %3Cp%3EExample of usage:%0A     * %3Cpre%3E %7B@code%0A     * AssertionError failure = expectFailure(whenTesting -%3E whenTesting.that(myType).hasProperty());%0A     * %7D%3C/pre%3E%0A     */%0A    protected AssertionError%0A    expectFailure(SimpleSubjectBuilderCallback%3CS, T%3E assertionCallback) %7B%0A        return expectFailureAbout(subjectFactory(), assertionCallback);%0A    %7D%0A%0A    /**%0A     * Expects that the passed callback causes %7B@code AssertionError%7D and ignores it.%0A     *%0A     * %3Cp%3EThis method is for test cases where the produced error is of no interest.%0A     * Example of usage:%0A     * %3Cpre%3E %7B@code%0A     * expectSomeFailure(whenTesting -%3E whenTesting.that(myType).hasProperty());%0A     * %7D%3C/pre%3E%0A     */%0A    @SuppressWarnings(%7B%22ThrowableNotThrown%22, %22CheckReturnValue%22%7D) // Ignore the AssertionError.%0A    protected void%0A    expectSomeFailure(SimpleSubjectBuilderCallback%3CS, T%3E assertionCallback) %7B%0A        expectFailureAbout(subjectFactory(), assertionCallback);%0A    %7D%0A%7D%0A

Add abstract base for testing `Subject`s