MySQLErrPacket implements MySQLPacket { @Override public void write(final MySQLPacketPayload payload) { payload.writeInt1(HEADER); payload.writeInt2(errorCode); payload.writeStringFix(SQL_STATE_MARKER); payload.writeStringFix(sqlState); payload.writeStringEOF(errorMessage); } MySQLErrPacket(final int sequenceId, final SQLErrorCode sqlErrorCode, final Object... errorMessageArguments);  MySQLErrPacket(final MySQLPacketPayload payload); @Override void write(final MySQLPacketPayload payload); static final int HEADER; }
@Test public void assertWrite() { new MySQLErrPacket(1, MySQLServerErrorCode.ER_NO_DB_ERROR).write(payload); verify(payload).writeInt1(MySQLErrPacket.HEADER); verify(payload).writeInt2(1046); verify(payload).writeStringFix("#"); verify(payload).writeStringFix("3D000"); verify(payload).writeStringEOF("No database selected"); }