@@ -0,0 +1,2680 @@
+/*%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.validate.option;%0A%0Aimport io.spine.validate.ComparableNumber;%0Aimport org.junit.jupiter.api.DisplayName;%0Aimport org.junit.jupiter.api.Test;%0Aimport org.junit.jupiter.params.ParameterizedTest;%0Aimport org.junit.jupiter.params.provider.MethodSource;%0A%0Aimport java.math.BigDecimal;%0Aimport java.util.stream.Stream;%0A%0Aimport static org.junit.jupiter.api.Assertions.assertFalse;%0Aimport static org.junit.jupiter.api.Assertions.assertTrue;%0A%0A@DisplayName(%22NumberConversionChecker should tell that%22)%0Afinal class NumberConversionCheckerTest %7B%0A%0A    @DisplayName(%22it is possible to convert byte to byte%22)%0A    @Test%0A    void byteToByte() %7B%0A        assertTrue(NumberConversionChecker.canConvert(Byte.valueOf(%221%22), Byte.valueOf(%222%22)));%0A    %7D%0A%0A    @DisplayName(%22it is not possible to convert non-byte to byte%22)%0A    @ParameterizedTest%0A    @MethodSource(%22nonBytes%22)%0A    void byteToOthers(Number nonByte) %7B%0A        assertFalse(NumberConversionChecker.canConvert(Byte.valueOf(%221%22), nonByte));%0A    %7D%0A%0A    @DisplayName(%22ComparableNumber instances are automatically unwrapped%22)%0A    @Test%0A    void comparableNumbersAreUnwrapped() %7B%0A        ComparableNumber number = new ComparableNumber(3);%0A        assertTrue(NumberConversionChecker.canConvert(number, number));%0A    %7D%0A%0A    @DisplayName(%22BigDecimals are not supported%22)%0A    @Test%0A    void bigDecimalsAreNotSupported() %7B%0A        assertFalse(NumberConversionChecker.canConvert(BigDecimal.valueOf(1), 1L));%0A    %7D%0A%0A    //TODO:2019-06-11:ysergiichuk: Add tests for Short, Integer, Long, Float and Double conversions%0A%0A    private static Stream%3CNumber%3E nonBytes() %7B%0A        return Stream.of(Short.valueOf(%221%22), 2, 3L, 4.0, 5.1f);%0A    %7D%0A%7D%0A

Add stub NumberConversionChecker test