@Override
    protected void write(final PostgreSQLPacketPayload payload) {
        for (Entry<Character, String> entry : fields.entrySet()) {
            payload.writeInt1(entry.getKey());
            payload.writeStringNul(entry.getValue());
        }
        payload.writeInt1(0);
    }
@Test
    void assertWritePacketFromSeverityAndMessage() {
        OpenGaussErrorResponsePacket packet = new OpenGaussErrorResponsePacket("FATAL", "3D000", "database \"test\" does not exist");
        PostgreSQLPacketPayload payload = mock(PostgreSQLPacketPayload.class);
        packet.write(payload);
        verify(payload).writeInt1(OpenGaussErrorResponsePacket.FIELD_TYPE_SEVERITY);
        verify(payload).writeStringNul("FATAL");
        verify(payload).writeInt1(OpenGaussErrorResponsePacket.FIELD_TYPE_CODE);
        verify(payload).writeStringNul("3D000");
        verify(payload).writeInt1(OpenGaussErrorResponsePacket.FIELD_TYPE_MESSAGE);
        verify(payload).writeStringNul("database \"test\" does not exist");
        verify(payload).writeInt1(OpenGaussErrorResponsePacket.FIELD_TYPE_ERROR_CODE);
        verify(payload).writeStringNul("0");
    }