@@ -0,0 +1,2881 @@
+/*%0A * Copyright 2017 ZJNU ACM.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage cn.edu.zjnu.acm.judge.config;%0A%0Aimport cn.edu.zjnu.acm.judge.Application;%0Aimport java.nio.charset.StandardCharsets;%0Aimport java.sql.Connection;%0Aimport java.sql.PreparedStatement;%0Aimport java.sql.ResultSet;%0Aimport java.sql.SQLException;%0Aimport javax.sql.DataSource;%0Aimport lombok.extern.slf4j.Slf4j;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.boot.test.context.SpringBootTest;%0Aimport org.springframework.test.context.junit4.SpringJUnit4ClassRunner;%0Aimport org.springframework.test.context.web.WebAppConfiguration;%0A%0Aimport static org.junit.Assert.assertEquals;%0A%0A/**%0A *%0A * @author zhanhb%0A */%0A@RunWith(SpringJUnit4ClassRunner.class)%0A@Slf4j%0A@SpringBootTest(classes = Application.class)%0A@WebAppConfiguration%0Apublic class UnicodeTest %7B%0A%0A    @Autowired%0A    private DataSource dataSource;%0A%0A    @Test%0A    public void testUnicode() throws SQLException %7B%0A        int x = 0x1f602;%0A        char%5B%5D toChars = Character.toChars(x);%0A        String laughCry = new String(toChars);%0A%0A        try (Connection connection = dataSource.getConnection()) %7B%0A            connection.prepareStatement(%22CREATE TABLE %60test_table1%60(%60id%60 INT NOT NULL, %60value%60 LONGTEXT NULL, PRIMARY KEY (%60id%60) ) COLLATE='utf8mb4_general_ci'%22).execute();%0A            try %7B%0A                try (PreparedStatement ps = connection.prepareStatement(%22insert into test_table1(id,value)values(1,?)%22)) %7B%0A                    ps.setBytes(1, laughCry.getBytes(StandardCharsets.UTF_8));%0A                    ps.executeUpdate();%0A                %7D%0A                try (PreparedStatement ps = connection.prepareStatement(%22insert into test_table1(id,value)values(2,?)%22)) %7B%0A                    ps.setString(1, laughCry);%0A                    ps.executeUpdate();%0A                %7D%0A                try (PreparedStatement ps = connection.prepareStatement(%22select value from test_table1 where id in(1,2)%22);%0A                        ResultSet rs = ps.executeQuery()) %7B%0A                    while (rs.next()) %7B%0A                        assertEquals(laughCry, rs.getString(1));%0A                    %7D%0A                %7D%0A            %7D finally %7B%0A                connection.prepareStatement(%22DROP TABLE %60test_table1%60%22).execute();%0A            %7D%0A        %7D%0A    %7D%0A%0A%7D%0A

Add unicode test