@Test
  public void testEndpointConnection() throws Exception {
    // For partitioned table, partitionVals are specified
    StrictDelimitedInputWriter writer = StrictDelimitedInputWriter.newBuilder()
      .withFieldDelimiter(',')
      .build();
    HiveStreamingConnection connection = HiveStreamingConnection.newBuilder()
      .withDatabase(dbName)
      .withTable(tblName)
      .withStaticPartitionValues(partitionVals)
      .withAgentInfo("UT_" + Thread.currentThread().getName())
      .withRecordWriter(writer)
      .withHiveConf(conf)
      .connect();
    connection.close();

    // For unpartitioned table, partitionVals are not specified
    connection = HiveStreamingConnection.newBuilder()
      .withDatabase(dbName2)
      .withTable(tblName2)
      .withAgentInfo("UT_" + Thread.currentThread().getName())
      .withRecordWriter(writer)
      .withHiveConf(conf)
      .connect();
    connection.close();

    // For unpartitioned table, partition values are specified
    try {
      connection = HiveStreamingConnection.newBuilder()
        .withDatabase(dbName2)
        .withTable(tblName2)
        .withStaticPartitionValues(partitionVals)
        .withAgentInfo("UT_" + Thread.currentThread().getName())
        .withRecordWriter(writer)
        .withHiveConf(conf)
        .connect();
      Assert.assertTrue("ConnectionError was not thrown", false);
      connection.close();
    } catch (ConnectionError e) {
      // expecting this exception
      String errMsg = "specifies partitions for un-partitioned table";
      Assert.assertTrue(e.toString().endsWith(errMsg));
    }
  }
@param validationQuery query to read from table to compare data against {@code records}
@param records         expected data.  each row is CVS list of values
streaming/src/test/org/apache/hive/streaming/TestStreaming.java