Source:
public void testFORMAT_TIMESTAMP() throws Exception { System.out.println("STARTING testFORMAT_TIMESTAMP"); Client client = getClient(); ClientResponse cr; cr = client.callProcedure("P2.insert", 1, "2013-07-18 02:00:00.123457"); assertEquals(ClientResponse.SUCCESS, cr.getStatus()); cr = client.callProcedure("P2.insert", 2, null); assertEquals(ClientResponse.SUCCESS, cr.getStatus()); cr = client.callProcedure("FORMAT_TIMESTAMP", "UTC", 2); assertEquals(ClientResponse.SUCCESS, cr.getStatus()); assertContentOfTable(new Object[][]{{null}}, cr.getResults()[0]); cr = client.callProcedure("FORMAT_TIMESTAMP", null, 1); assertEquals(ClientResponse.SUCCESS, cr.getStatus()); assertContentOfTable(new Object[][]{{"2013-07-18 02:00:00.123457"}}, cr.getResults()[0]); String[] invalid_offsets = {"I_AM_INVALID", "HOME/TRASH", "10:00", "-1:00"}; String expectedError = "VOLTDB ERROR: SQL ERROR\\s*" + "invalid timezone string\\s*"; for (String invalid_offset : invalid_offsets) { verifyProcFails(client, expectedError, "FORMAT_TIMESTAMP", invalid_offset, 1); } String[] offsets = {"UTC", "Australia/Adelaide", "America/Atikokan", "America/Belize", "Asia/Shanghai", "+02:30", "-10:00", " +02:30", " -10:00 "}; String[] results = {"2013-07-18 02:00:00.123457", "2013-07-18 11:30:00.123457", "2013-07-17 21:00:00.123457", "2013-07-17 20:00:00.123457", "2013-07-18 10:00:00.123457", "2013-07-18 04:30:00.123457", "2013-07-17 16:00:00.123457", "2013-07-18 04:30:00.123457", "2013-07-17 16:00:00.123457"}; for (int i = 0; i < offsets.length; i++) { cr = client.callProcedure("FORMAT_TIMESTAMP", offsets[i], 1); assertEquals(ClientResponse.SUCCESS, cr.getStatus()); assertContentOfTable(new Object[][]{{results[i]}}, cr.getResults()[0]); } }

Target:
public void testFORMAT_TIMESTAMP() throws Exception { System.out.println("STARTING testFORMAT_TIMESTAMP"); Client client = getClient(); ClientResponse cr; cr = client.callProcedure("P2.insert", 1, "2013-07-18 02:00:00.123457"); assertEquals(ClientResponse.SUCCESS, cr.getStatus()); cr = client.callProcedure("P2.insert", 2, null); assertEquals(ClientResponse.SUCCESS, cr.getStatus()); cr = client.callProcedure("FORMAT_TIMESTAMP", "UTC", 2); assertContentOfTable(new Object[][]{{null}}, cr.getResults()[0]); cr = client.callProcedure("FORMAT_TIMESTAMP", null, 1); assertContentOfTable(new Object[][]{{"2013-07-18 02:00:00.123457"}}, cr.getResults()[0]); String[] invalid_offsets = {"I_AM_INVALID", "HOME/TRASH", "10:00", "-1:00"}; String expectedError = "Invalid timezone string\\s*"; for (String invalid_offset : invalid_offsets) { verifyProcFails(client, expectedError, "FORMAT_TIMESTAMP", invalid_offset, 1); } String[] offsets = {"UTC", "Australia/Adelaide", "America/Atikokan", "America/Belize", "Asia/Shanghai", "+02:30", "-10:00", " +02:30", " -10:00 "}; String[] results = {"2013-07-18 02:00:00.123457", "2013-07-18 11:30:00.123457", "2013-07-17 21:00:00.123457", "2013-07-17 20:00:00.123457", "2013-07-18 10:00:00.123457", "2013-07-18 04:30:00.123457", "2013-07-17 16:00:00.123457", "2013-07-18 04:30:00.123457", "2013-07-17 16:00:00.123457"}; for (int i = 0; i < offsets.length; i++) { cr = client.callProcedure("FORMAT_TIMESTAMP", offsets[i], 1); assertContentOfTable(new Object[][]{{results[i]}}, cr.getResults()[0]); } }