Skip to content

Commit

Permalink
[misc] test suite better error description
Browse files Browse the repository at this point in the history
  • Loading branch information
rusher committed Sep 9, 2022
1 parent e60dd93 commit 66e6130
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/test/java/org/mariadb/jdbc/integration/MultiPacketTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package org.mariadb.jdbc.integration;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
Expand Down Expand Up @@ -49,23 +50,27 @@ public void bigByteSend() throws SQLException {
prep.execute();
}
ResultSet rs = stmt.executeQuery("SELECT t2 FROM multiPacketTest");
rs.next();
assertTrue(rs.next(), "expected rows");
assertEquals("2", rs.getString(1));
}

@Test
public void bigByte2Send() throws SQLException {
public void bigByte2Send() throws Throwable {
Statement stmt = sharedConn.createStatement();
stmt.execute("TRUNCATE multiPacketTest");
stmt.execute("START TRANSACTION"); // if MAXSCALE ensure using WRITER
try (PreparedStatement prep =
sharedConnBinary.prepareStatement("INSERT INTO multiPacketTest VALUE (?,?)")) {
prep.setString(1, "test1");
prep.setByte(2, (byte) 1);
prep.execute();
prep.setString(1, new String(arr2, 0, 16 * 1024 * 1024 - 21));
prep.setByte(2, (byte) 2);
prep.execute();
}
ResultSet rs = stmt.executeQuery("SELECT t2 FROM multiPacketTest");
rs.next();
assertTrue(rs.next(), "expected rows");
assertTrue(rs.next());
assertEquals("2", rs.getString(1));
}

Expand All @@ -81,7 +86,7 @@ public void bigShortSend() throws SQLException {
prep.execute();
}
ResultSet rs = stmt.executeQuery("SELECT t2 FROM multiPacketTest");
rs.next();
assertTrue(rs.next(), "expected rows");
assertEquals("2", rs.getString(1));
}

Expand All @@ -97,7 +102,7 @@ public void bigIntSend() throws SQLException {
prep.execute();
}
ResultSet rs = stmt.executeQuery("SELECT t2 FROM multiPacketTest");
rs.next();
assertTrue(rs.next(), "expected rows");
assertEquals("2", rs.getString(1));
}

Expand All @@ -113,7 +118,7 @@ public void bigLongSend() throws SQLException {
prep.execute();
}
ResultSet rs = stmt.executeQuery("SELECT t2 FROM multiPacketTest");
rs.next();
assertTrue(rs.next(), "expected rows");
assertEquals("2", rs.getString(1));
}

Expand All @@ -138,7 +143,7 @@ public void bigStringSend() throws SQLException {
}
}
ResultSet rs = stmt.executeQuery("SELECT t2 FROM multiPacketTest");
rs.next();
assertTrue(rs.next(), "expected rows");
assertEquals(new String(arr2, 0, 30_000), rs.getString(1));
rs.next();
assertEquals(new String(arr2, 0, 70_000), rs.getString(1));
Expand Down

0 comments on commit 66e6130

Please sign in to comment.