PostgreSQLBinaryProtocolValueFactory { public static PostgreSQLBinaryProtocolValue getBinaryProtocolValue(final PostgreSQLColumnType columnType) { Preconditions.checkArgument(BINARY_PROTOCOL_VALUES.containsKey(columnType), "Cannot find PostgreSQL type '%s' in column type when process binary protocol value", columnType); return BINARY_PROTOCOL_VALUES.get(columnType); }  static PostgreSQLBinaryProtocolValue getBinaryProtocolValue(final PostgreSQLColumnType columnType);  }
@Test public void assertGetStringBinaryProtocolValue() { PostgreSQLBinaryProtocolValue binaryProtocolValue = PostgreSQLBinaryProtocolValueFactory.getBinaryProtocolValue(PostgreSQLColumnType.POSTGRESQL_TYPE_VARCHAR); assertThat(binaryProtocolValue, instanceOf(PostgreSQLStringBinaryProtocolValue.class)); }
@Test public void assertGetInt8BinaryProtocolValue() { PostgreSQLBinaryProtocolValue binaryProtocolValue = PostgreSQLBinaryProtocolValueFactory.getBinaryProtocolValue(PostgreSQLColumnType.POSTGRESQL_TYPE_INT8); assertThat(binaryProtocolValue, instanceOf(PostgreSQLInt8BinaryProtocolValue.class)); }
@Test public void assertGetInt4BinaryProtocolValue() { PostgreSQLBinaryProtocolValue binaryProtocolValue = PostgreSQLBinaryProtocolValueFactory.getBinaryProtocolValue(PostgreSQLColumnType.POSTGRESQL_TYPE_INT4); assertThat(binaryProtocolValue, instanceOf(PostgreSQLInt4BinaryProtocolValue.class)); }
@Test public void assertGetInt2BinaryProtocolValue() { PostgreSQLBinaryProtocolValue binaryProtocolValue = PostgreSQLBinaryProtocolValueFactory.getBinaryProtocolValue(PostgreSQLColumnType.POSTGRESQL_TYPE_INT2); assertThat(binaryProtocolValue, instanceOf(PostgreSQLInt2BinaryProtocolValue.class)); }
@Test public void assertGetDoubleBinaryProtocolValue() { PostgreSQLBinaryProtocolValue binaryProtocolValue = PostgreSQLBinaryProtocolValueFactory.getBinaryProtocolValue(PostgreSQLColumnType.POSTGRESQL_TYPE_FLOAT8); assertThat(binaryProtocolValue, instanceOf(PostgreSQLDoubleBinaryProtocolValue.class)); }
@Test public void assertGetFloatBinaryProtocolValue() { PostgreSQLBinaryProtocolValue binaryProtocolValue = PostgreSQLBinaryProtocolValueFactory.getBinaryProtocolValue(PostgreSQLColumnType.POSTGRESQL_TYPE_FLOAT4); assertThat(binaryProtocolValue, instanceOf(PostgreSQLFloatBinaryProtocolValue.class)); }
@Test public void assertGetDateBinaryProtocolValue() { PostgreSQLBinaryProtocolValue binaryProtocolValue = PostgreSQLBinaryProtocolValueFactory.getBinaryProtocolValue(PostgreSQLColumnType.POSTGRESQL_TYPE_DATE); assertThat(binaryProtocolValue, instanceOf(PostgreSQLDateBinaryProtocolValue.class)); }
@Test public void assertGetTimeBinaryProtocolValue() { PostgreSQLBinaryProtocolValue binaryProtocolValue = PostgreSQLBinaryProtocolValueFactory.getBinaryProtocolValue(PostgreSQLColumnType.POSTGRESQL_TYPE_TIMESTAMP); assertThat(binaryProtocolValue, instanceOf(PostgreSQLTimeBinaryProtocolValue.class)); }
@Test(expected = IllegalArgumentException.class) public void assertGetBinaryProtocolValueExThrown() { PostgreSQLBinaryProtocolValueFactory.getBinaryProtocolValue(PostgreSQLColumnType.POSTGRESQL_TYPE_XML); }