@Test
public void testSerializeRequestWithoutTxn() throws IOException {

    // Arrange
    TxnHeader header = mock(TxnHeader.class);
    doAnswer(new Answer() {
        @Override
        public Object answer(InvocationOnMock invocation) throws Throwable {
            Object[] args = invocation.getArguments();
            OutputArchive oa = (OutputArchive) args[0];
            oa.writeString("header", "test");
            return null;
        }
    }).when(header).serialize(any(OutputArchive.class), anyString());
    Request request = new Request(1, 2, 3, header, null, 4);
    // Act
    byte[] data = SerializeUtils.serializeRequest(request);
    // Assert
    assertNotNull(data);
    verify(header).serialize(any(OutputArchive.class), eq("hdr"));
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    BinaryOutputArchive boa = BinaryOutputArchive.getArchive(baos);
    boa.writeString("header", "test");
    baos.close();
    assertArrayEquals(baos.toByteArray(), data);
}