@@ -0,0 +1,3239 @@
+/*%0A * Copyright 2017, TeamDev Ltd. 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 org.spine3.server.entity.storage;%0A%0Aimport org.junit.Test;%0A%0Aimport static org.hamcrest.CoreMatchers.containsString;%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.junit.Assert.assertThat;%0A%0A/**%0A * An example of using %7B@link ColumnType%7D %7B@code interface%7D.%0A *%0A * @author Dmytro Dashenkov%0A */%0Apublic class ColumnTypeShould %7B%0A%0A    private static final int VALUE = 42;%0A    private static final String KEY = %22the Answer%22;%0A%0A    private static final String EXPECTED_RESULT = %22the Answer: 42%22;%0A%0A    @Test%0A    public void convert_java_type_to_store_as_type() %7B%0A        final String stringValue = String.valueOf(VALUE);%0A        final ColumnType%3CInteger, String, ?, ?%3E type = new TestColumnType%3C%3E();%0A        final String storedValue = type.convertColumnValue(VALUE);%0A        assertEquals(stringValue, storedValue);%0A    %7D%0A%0A    @Test%0A    public void store_value_to_a_container() %7B%0A        final String stringValue = String.valueOf(VALUE);%0A        final StringBuilder container = new StringBuilder(16);%0A        final ColumnType%3C?, String, StringBuilder, String%3E type = new TestColumnType%3C%3E();%0A        type.setColumnValue(container, stringValue, KEY);%0A%0A        assertThat(container.toString(), containsString(EXPECTED_RESULT));%0A    %7D%0A%0A    @Test%0A    public void provide_interface_for_entire_storage_preparation_flow() %7B%0A        final ColumnType%3CInteger, String, StringBuilder, String%3E type = new TestColumnType%3C%3E();%0A        final StringBuilder container = new StringBuilder(16);%0A%0A        type.setColumnValue(container, type.convertColumnValue(VALUE), KEY);%0A%0A        assertThat(container.toString(), containsString(EXPECTED_RESULT));%0A    %7D%0A%0A    private static class TestColumnType%3CT%3E implements ColumnType%3CT, String, StringBuilder, String%3E %7B%0A%0A        @Override%0A        public String convertColumnValue(T fieldValue) %7B%0A            return String.valueOf(fieldValue);%0A        %7D%0A%0A        @Override%0A        public void setColumnValue(StringBuilder storageRecord,%0A                                   String value,%0A                                   String columnIdentifier) %7B%0A            storageRecord.append(columnIdentifier)%0A                         .append(%22: %22)%0A                         .append(value);%0A        %7D%0A    %7D%0A%7D%0A

Add tests-sample for the ColumnType.