ResponsePacketBuilder { public static Collection<DatabasePacket<?>> buildUpdateResponsePackets(final UpdateResponse updateResponse) { return Collections.singletonList(new MySQLOKPacket(1, updateResponse.getUpdateCount(), updateResponse.getLastInsertId())); }  static Collection<DatabasePacket<?>> buildQueryResponsePackets(final QueryResponse queryResponse); static Collection<DatabasePacket<?>> buildUpdateResponsePackets(final UpdateResponse updateResponse);  }
@Test public void assertBuildUpdateResponsePackets() { UpdateResponse updateResponse = mock(UpdateResponse.class); when(updateResponse.getUpdateCount()).thenReturn(10L); when(updateResponse.getLastInsertId()).thenReturn(100L); Collection<DatabasePacket<?>> actual = ResponsePacketBuilder.buildUpdateResponsePackets(updateResponse); MySQLOKPacket actualItem = (MySQLOKPacket) actual.stream().findAny().get(); assertThat(actualItem, instanceOf(MySQLOKPacket.class)); assertThat(actualItem.getAffectedRows(), is(10L)); assertThat(actualItem.getLastInsertId(), is(100L)); }