@@ -0,0 +1,1503 @@
+package test;%0A%0Aimport static org.junit.Assert.assertEquals;%0A%0Aimport java.sql.Connection;%0Aimport java.sql.DriverManager;%0Aimport java.sql.PreparedStatement;%0Aimport java.sql.SQLException;%0A%0Aimport mockit.Expectations;%0Aimport mockit.integration.junit4.JMockit;%0A%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0A%0A@RunWith(JMockit.class)%0Apublic class PreparedStatementTest %7B%0A%0A    private int executeUpdate(String sql) throws SQLException %7B%0A        try (Connection conn =%0A                DriverManager.getConnection(%22jdbc:mysql://127.0.0.1:3306/test?user=root&password=password%22);%0A                PreparedStatement stmt = conn.prepareStatement(sql);) %7B%0A            return stmt.executeUpdate();%0A        %7D catch (SQLException e) %7B%0A            throw e;%0A        %7D%0A    %7D%0A%0A    @Test%0A    public void test() throws SQLException %7B%0A        new Expectations() %7B%0A            %7B%0A            %7D%0A        %7D;%0A        String sql =%0A                %22insert into employees (id,job_code, store_id) values (7, 4, 19) on duplicate key update id = 7, job_code = 4, separated = now();%22;%0A        int executeUpdate1 = executeUpdate(sql);%0A        int executeUpdate2 = executeUpdate(sql);%0A        int executeUpdate3 = executeUpdate(sql);%0A%0A        System.out.println(%221%E5%9B%9E%E7%9B%AE : %22 + executeUpdate1);%0A        System.out.println(%222%E5%9B%9E%E7%9B%AE : %22 + executeUpdate2);%0A        System.out.println(%223%E5%9B%9E%E7%9B%AE : %22 + executeUpdate3);%0A%0A        assertEquals(executeUpdate1, 1);%0A        assertEquals(executeUpdate2, 2);%0A        assertEquals(executeUpdate3, 0);%0A    %7D%0A%7D%0A

Create PreparedStatementTest.java