11package org .influxdb ;
22
3+ import static org .assertj .core .api .Assertions .assertThat ;
4+
35import java .io .IOException ;
46import java .util .concurrent .TimeUnit ;
57import java .util .logging .Level ;
@@ -130,7 +132,6 @@ public void testTicket39() {
130132
131133 /**
132134 * Test for ticket #40
133- *
134135 */
135136 @ Test (enabled = true )
136137 public void testTicket40 () {
@@ -143,4 +144,28 @@ public void testTicket40() {
143144 }
144145 this .influxDB .deleteDatabase (dbName );
145146 }
147+
148+ /**
149+ * Test for ticket #40
150+ */
151+ @ Test (enabled = true )
152+ public void testTicket44 () {
153+ Point point = Point .measurement ("test" ).time (1 , TimeUnit .MICROSECONDS ).field ("a" , 1 ).build ();
154+ assertThat (point .lineProtocol ()).asString ().isEqualTo ("test a=1 1000" );
155+
156+ point = Point .measurement ("test" ).time (1 , TimeUnit .MILLISECONDS ).field ("a" , 1 ).build ();
157+ assertThat (point .lineProtocol ()).asString ().isEqualTo ("test a=1 1000000" );
158+
159+ point = Point .measurement ("test" ).time (1 , TimeUnit .NANOSECONDS ).field ("a" , 1 ).build ();
160+ BatchPoints batchPoints = BatchPoints .database ("db" ).point (point ).build ();
161+ assertThat (batchPoints .lineProtocol ()).asString ().isEqualTo ("test a=1 1\n " );
162+
163+ point = Point .measurement ("test" ).time (1 , TimeUnit .MICROSECONDS ).field ("a" , 1 ).build ();
164+ batchPoints = BatchPoints .database ("db" ).point (point ).build ();
165+ assertThat (batchPoints .lineProtocol ()).asString ().isEqualTo ("test a=1 1000\n " );
166+
167+ point = Point .measurement ("test" ).time (1 , TimeUnit .MILLISECONDS ).field ("a" , 1 ).build ();
168+ batchPoints = BatchPoints .database ("db" ).point (point ).build ();
169+ assertThat (batchPoints .lineProtocol ()).asString ().isEqualTo ("test a=1 1000000\n " );
170+ }
146171}
0 commit comments