PostgreSQLCommandPacketTypeLoader { public static PostgreSQLCommandPacketType getCommandPacketType(final PostgreSQLPacketPayload payload) { return PostgreSQLCommandPacketType.valueOf(payload.readInt1()); }  static PostgreSQLCommandPacketType getCommandPacketType(final PostgreSQLPacketPayload payload);  }
@Test public void assertGetCommandPacketType() { PostgreSQLPacketPayload payload = mock(PostgreSQLPacketPayload.class); when(payload.readInt1()).thenReturn((int) PostgreSQLCommandPacketType.AUTHENTICATION_OK.getValue()); assertThat(PostgreSQLCommandPacketTypeLoader.getCommandPacketType(payload), is(PostgreSQLCommandPacketType.AUTHENTICATION_OK)); }
@Test(expected = IllegalArgumentException.class) public void assertGetCommandPacketTypeError() { PostgreSQLPacketPayload payload = mock(PostgreSQLPacketPayload.class); when(payload.readInt1()).thenReturn(0x21); PostgreSQLCommandPacketTypeLoader.getCommandPacketType(payload); }