From ab7f05830434502ad407bb21ba762be5bb9b99eb Mon Sep 17 00:00:00 2001 From: Sciator <39964450+Sciator@users.noreply.github.com> Date: Mon, 20 Nov 2023 13:34:13 +0100 Subject: [PATCH 1/5] test: PointTest basic tests --- .../com/influxdb/v3/client/PointTest.java | 89 +++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 src/test/java/com/influxdb/v3/client/PointTest.java diff --git a/src/test/java/com/influxdb/v3/client/PointTest.java b/src/test/java/com/influxdb/v3/client/PointTest.java new file mode 100644 index 0000000..f142292 --- /dev/null +++ b/src/test/java/com/influxdb/v3/client/PointTest.java @@ -0,0 +1,89 @@ +package com.influxdb.v3.client; + +import com.influxdb.v3.client.Point; +import com.influxdb.v3.client.write.WriteOptions; +import com.influxdb.v3.client.write.WritePrecision; +import org.junit.jupiter.api.Test; + +import java.math.BigInteger; +import java.time.Instant; +import java.time.temporal.ChronoUnit; +import java.util.HashMap; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.*; + +public class PointTest +{ + @Test + void setMeasurement() { + Point point = Point.measurement("measurement"); + assertEquals("measurement", point.getMeasurement()); + + point.setMeasurement("newMeasurement"); + assertEquals("newMeasurement", point.getMeasurement()); + } + + @Test + void setTimestamp() { + Point point = Point.measurement("measurement"); + + Instant timestamp = Instant.parse("2023-11-08T12:00:00Z"); + point.setTimestamp(timestamp); + assertEquals(BigInteger.valueOf(timestamp.getEpochSecond()).multiply(BigInteger.valueOf(1_000_000_000)) + , point.getTimestamp()); + } + + @Test + void setTags() { + Point point = Point.measurement("measurement"); + + Map tags = new HashMap<>(); + tags.put("tag1", "value1"); + tags.put("tag2", "value2"); + + point.setTags(tags); + + assertEquals("value1", point.getTag("tag1")); + assertEquals("value2", point.getTag("tag2")); + } + + @Test + void setFields() { + Point point = Point.measurement("measurement"); + + point.setField("field1", 42); + point.setField("field2", "value"); + point.setField("field3", 3.14); + + assertEquals(42L, point.getField("field1")); + assertEquals("value", point.getField("field2")); + assertEquals(3.14, point.getField("field3")); + } + + @Test + void toLineProtocol() { + Point point = Point.measurement("measurement") + .setTag("tag1", "value1") + .setField("field1", 42); + + String lineProtocol = point.toLineProtocol(WritePrecision.NS); + assertEquals("measurement,tag1=value1 field1=42i", lineProtocol); + } + + @Test + void copy() { + Point point = Point.measurement("measurement") + .setTag("tag1", "value1") + .setField("field1", 42); + + Point copy = point.copy(); + + // Ensure the copy is not the same object + assertNotSame(point, copy); + // Ensure the values are equal + assertEquals(point.getMeasurement(), copy.getMeasurement()); + assertEquals(point.getTag("tag1"), copy.getTag("tag1")); + assertEquals(point.getField("field1"), copy.getField("field1")); + } +} From 224b3ce24321568857248b6b662b72de9394bac5 Mon Sep 17 00:00:00 2001 From: Sciator <39964450+Sciator@users.noreply.github.com> Date: Mon, 20 Nov 2023 13:50:14 +0100 Subject: [PATCH 2/5] test: UnusedImports --- src/test/java/com/influxdb/v3/client/PointTest.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/test/java/com/influxdb/v3/client/PointTest.java b/src/test/java/com/influxdb/v3/client/PointTest.java index f142292..e9e6f39 100644 --- a/src/test/java/com/influxdb/v3/client/PointTest.java +++ b/src/test/java/com/influxdb/v3/client/PointTest.java @@ -1,13 +1,10 @@ package com.influxdb.v3.client; -import com.influxdb.v3.client.Point; -import com.influxdb.v3.client.write.WriteOptions; import com.influxdb.v3.client.write.WritePrecision; import org.junit.jupiter.api.Test; import java.math.BigInteger; import java.time.Instant; -import java.time.temporal.ChronoUnit; import java.util.HashMap; import java.util.Map; From 21fdb751c90dacc0475956f602101600af4f8a8b Mon Sep 17 00:00:00 2001 From: Sciator <39964450+Sciator@users.noreply.github.com> Date: Mon, 20 Nov 2023 14:21:16 +0100 Subject: [PATCH 3/5] test: PointValuesTest, lint fixes --- .../com/influxdb/v3/client/PointTest.java | 61 ++++++++---- .../influxdb/v3/client/PointValuesTest.java | 95 +++++++++++++++++++ 2 files changed, 136 insertions(+), 20 deletions(-) create mode 100644 src/test/java/com/influxdb/v3/client/PointValuesTest.java diff --git a/src/test/java/com/influxdb/v3/client/PointTest.java b/src/test/java/com/influxdb/v3/client/PointTest.java index e9e6f39..16c8a24 100644 --- a/src/test/java/com/influxdb/v3/client/PointTest.java +++ b/src/test/java/com/influxdb/v3/client/PointTest.java @@ -1,24 +1,44 @@ +/* + * The MIT License + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ package com.influxdb.v3.client; -import com.influxdb.v3.client.write.WritePrecision; -import org.junit.jupiter.api.Test; - import java.math.BigInteger; import java.time.Instant; import java.util.HashMap; import java.util.Map; -import static org.junit.jupiter.api.Assertions.*; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +import com.influxdb.v3.client.write.WritePrecision; -public class PointTest -{ +public class PointTest { @Test void setMeasurement() { Point point = Point.measurement("measurement"); - assertEquals("measurement", point.getMeasurement()); + Assertions.assertThat("measurement").isEqualTo(point.getMeasurement()); point.setMeasurement("newMeasurement"); - assertEquals("newMeasurement", point.getMeasurement()); + Assertions.assertThat("newMeasurement").isEqualTo(point.getMeasurement()); } @Test @@ -27,8 +47,9 @@ void setTimestamp() { Instant timestamp = Instant.parse("2023-11-08T12:00:00Z"); point.setTimestamp(timestamp); - assertEquals(BigInteger.valueOf(timestamp.getEpochSecond()).multiply(BigInteger.valueOf(1_000_000_000)) - , point.getTimestamp()); + Assertions.assertThat(BigInteger.valueOf(timestamp.getEpochSecond()) + .multiply(BigInteger.valueOf(1_000_000_000))) + .isEqualTo(point.getTimestamp()); } @Test @@ -41,8 +62,8 @@ void setTags() { point.setTags(tags); - assertEquals("value1", point.getTag("tag1")); - assertEquals("value2", point.getTag("tag2")); + Assertions.assertThat("value1").isEqualTo(point.getTag("tag1")); + Assertions.assertThat("value2").isEqualTo(point.getTag("tag2")); } @Test @@ -53,9 +74,9 @@ void setFields() { point.setField("field2", "value"); point.setField("field3", 3.14); - assertEquals(42L, point.getField("field1")); - assertEquals("value", point.getField("field2")); - assertEquals(3.14, point.getField("field3")); + Assertions.assertThat(42L).isEqualTo(point.getField("field1")); + Assertions.assertThat("value").isEqualTo(point.getField("field2")); + Assertions.assertThat(3.14).isEqualTo(point.getField("field3")); } @Test @@ -65,7 +86,7 @@ void toLineProtocol() { .setField("field1", 42); String lineProtocol = point.toLineProtocol(WritePrecision.NS); - assertEquals("measurement,tag1=value1 field1=42i", lineProtocol); + Assertions.assertThat("measurement,tag1=value1 field1=42i").isEqualTo(lineProtocol); } @Test @@ -77,10 +98,10 @@ void copy() { Point copy = point.copy(); // Ensure the copy is not the same object - assertNotSame(point, copy); + Assertions.assertThat(point).isNotSameAs(copy); // Ensure the values are equal - assertEquals(point.getMeasurement(), copy.getMeasurement()); - assertEquals(point.getTag("tag1"), copy.getTag("tag1")); - assertEquals(point.getField("field1"), copy.getField("field1")); + Assertions.assertThat(point.getMeasurement()).isEqualTo(copy.getMeasurement()); + Assertions.assertThat(point.getTag("tag1")).isEqualTo(copy.getTag("tag1")); + Assertions.assertThat(point.getField("field1")).isEqualTo(copy.getField("field1")); } } diff --git a/src/test/java/com/influxdb/v3/client/PointValuesTest.java b/src/test/java/com/influxdb/v3/client/PointValuesTest.java new file mode 100644 index 0000000..c205fdf --- /dev/null +++ b/src/test/java/com/influxdb/v3/client/PointValuesTest.java @@ -0,0 +1,95 @@ +/* + * The MIT License + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +package com.influxdb.v3.client; + +import java.math.BigInteger; +import java.time.Instant; +import java.util.HashMap; +import java.util.Map; + +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class PointValuesTest { + @Test + void setMeasurement() { + PointValues pointValues = PointValues.measurement("measurement"); + Assertions.assertThat("measurement").isEqualTo(pointValues.getMeasurement()); + + pointValues.setMeasurement("newMeasurement"); + Assertions.assertThat("newMeasurement").isEqualTo(pointValues.getMeasurement()); + } + + @Test + void setTimestamp() { + PointValues pointValues = PointValues.measurement("measurement"); + + Instant timestamp = Instant.parse("2023-11-08T12:00:00Z"); + pointValues.setTimestamp(timestamp); + Assertions.assertThat(BigInteger.valueOf(timestamp.getEpochSecond()) + .multiply(BigInteger.valueOf(1_000_000_000))) + .isEqualTo(pointValues.getTimestamp()); + } + + @Test + void setTags() { + PointValues pointValues = PointValues.measurement("measurement"); + + Map tags = new HashMap<>(); + tags.put("tag1", "value1"); + tags.put("tag2", "value2"); + + pointValues.setTags(tags); + + Assertions.assertThat("value1").isEqualTo(pointValues.getTag("tag1")); + Assertions.assertThat("value2").isEqualTo(pointValues.getTag("tag2")); + } + + @Test + void setFields() { + PointValues pointValues = PointValues.measurement("measurement"); + + pointValues.setField("field1", 42); + pointValues.setField("field2", "value"); + pointValues.setField("field3", 3.14); + + Assertions.assertThat(42L).isEqualTo(pointValues.getField("field1")); + Assertions.assertThat("value").isEqualTo(pointValues.getField("field2")); + Assertions.assertThat(3.14).isEqualTo(pointValues.getField("field3")); + } + + @Test + void copy() { + PointValues pointValues = PointValues.measurement("measurement") + .setTag("tag1", "value1") + .setField("field1", 42); + + PointValues copy = pointValues.copy(); + + // Ensure the copy is not the same object + Assertions.assertThat(pointValues).isNotSameAs(copy); + // Ensure the values are equal + Assertions.assertThat(pointValues.getMeasurement()).isEqualTo(copy.getMeasurement()); + Assertions.assertThat(pointValues.getTag("tag1")).isEqualTo(copy.getTag("tag1")); + Assertions.assertThat(pointValues.getField("field1")).isEqualTo(copy.getField("field1")); + } +} From 309ce50767df28497d218eac7efe546a2cfcef9e Mon Sep 17 00:00:00 2001 From: Sciator <39964450+Sciator@users.noreply.github.com> Date: Mon, 20 Nov 2023 14:56:58 +0100 Subject: [PATCH 4/5] test: point tests --- .../com/influxdb/v3/client/PointTest.java | 88 ++++++++++++++++++- 1 file changed, 86 insertions(+), 2 deletions(-) diff --git a/src/test/java/com/influxdb/v3/client/PointTest.java b/src/test/java/com/influxdb/v3/client/PointTest.java index 16c8a24..d045d03 100644 --- a/src/test/java/com/influxdb/v3/client/PointTest.java +++ b/src/test/java/com/influxdb/v3/client/PointTest.java @@ -32,6 +32,20 @@ import com.influxdb.v3.client.write.WritePrecision; public class PointTest { + @Test + void fromValues() throws Exception { + PointValues pointValues = PointValues.measurement("measurement") + .setField("field1", 42); + Point point = Point.fromValues(pointValues); + + Assertions.assertThat("measurement").isEqualTo(point.getMeasurement()); + + Assertions.assertThat(42L).isEqualTo(point.getField("field1")); + point.setMeasurement("newMeasurement"); + Assertions.assertThat("newMeasurement").isEqualTo(point.getMeasurement()); + Assertions.assertThat("newMeasurement").isEqualTo(pointValues.getMeasurement()); + } + @Test void setMeasurement() { Point point = Point.measurement("measurement"); @@ -62,8 +76,78 @@ void setTags() { point.setTags(tags); - Assertions.assertThat("value1").isEqualTo(point.getTag("tag1")); - Assertions.assertThat("value2").isEqualTo(point.getTag("tag2")); + Assertions.assertThat(point.getTag("tag1")).isEqualTo("value1"); + Assertions.assertThat(point.getTag("tag2")).isEqualTo("value2"); + + + } + + @Test + void removeTag() { + Point point = Point.measurement("measurement") + .setTag("tag1", "value1") + .setTag("tag2", "value2"); + + point.removeTag("tag1"); + point.removeTag("tagNonExistent"); + + Assertions.assertThat(point.getTag("tag1")).isNull(); + Assertions.assertThat(point.getTag("tag2")).isEqualTo("value2"); + } + + @Test + void getTagNames() { + Point point = Point.measurement("measurement") + .setTag("tag1", "value1") + .setTag("tag2", "value2"); + + Assertions.assertThat(point.getTagNames()).isEqualTo(new String[]{"tag1", "tag2"}); + } + + @Test + void setGetTypeField() { + Point point = Point.measurement("measurement"); + + double floatValue = 2.71; + long integerValue = 64L; + boolean booleanValue = true; + String stringValue = "text"; + + point.setFloatField("floatField", floatValue); + point.setIntegerField("integerField", integerValue); + point.setBooleanField("booleanField", booleanValue); + point.setStringField("stringField", stringValue); + + Assertions.assertThat(point.getFloatField("floatField")).isEqualTo(floatValue); + Assertions.assertThat(point.getIntegerField("integerField")).isEqualTo(integerValue); + Assertions.assertThat(point.getBooleanField("booleanField")).isEqualTo(booleanValue); + Assertions.assertThat(point.getStringField("stringField")).isEqualTo(stringValue); + } + + @Test + void fieldGenerics() { + Point point = Point.measurement("measurement"); + + double floatValue = 2.71; + long integerValue = 64L; + boolean booleanValue = true; + String stringValue = "text"; + + point.setField("floatField", floatValue); + point.setField("integerField", integerValue); + point.setField("booleanField", booleanValue); + point.setField("stringField", stringValue); + + Assertions.assertThat(point.getField("floatField", Double.class)).isEqualTo(floatValue); + Assertions.assertThat(point.getFieldType("floatField")).isEqualTo(Double.class); + Assertions.assertThat(point.getField("integerField", Long.class)).isEqualTo(integerValue); + Assertions.assertThat(point.getFieldType("integerField")).isEqualTo(Long.class); + Assertions.assertThat(point.getField("booleanField", Boolean.class)).isEqualTo(booleanValue); + Assertions.assertThat(point.getFieldType("booleanField")).isEqualTo(Boolean.class); + Assertions.assertThat(point.getField("stringField", String.class)).isEqualTo(stringValue); + Assertions.assertThat(point.getFieldType("stringField")).isEqualTo(String.class); + Assertions.assertThat(point.getField("Missing", String.class)).isNull(); + Assertions.assertThat(point.getFieldType("Missing")).isNull(); } @Test From b3b214d5c543e1794a4ad238519ee089db04acd4 Mon Sep 17 00:00:00 2001 From: Sciator <39964450+Sciator@users.noreply.github.com> Date: Tue, 21 Nov 2023 09:47:41 +0100 Subject: [PATCH 5/5] test: Point, PointValues --- .../com/influxdb/v3/client/PointTest.java | 28 ++++- .../influxdb/v3/client/PointValuesTest.java | 107 ++++++++++++++++++ 2 files changed, 133 insertions(+), 2 deletions(-) diff --git a/src/test/java/com/influxdb/v3/client/PointTest.java b/src/test/java/com/influxdb/v3/client/PointTest.java index d045d03..01d7944 100644 --- a/src/test/java/com/influxdb/v3/client/PointTest.java +++ b/src/test/java/com/influxdb/v3/client/PointTest.java @@ -78,8 +78,6 @@ void setTags() { Assertions.assertThat(point.getTag("tag1")).isEqualTo("value1"); Assertions.assertThat(point.getTag("tag2")).isEqualTo("value2"); - - } @Test @@ -163,6 +161,32 @@ void setFields() { Assertions.assertThat(3.14).isEqualTo(point.getField("field3")); } + @Test + void removeField() { + Point point = Point.measurement("measurement") + .setField("field1", 42) + .setField("field2", "value") + .setField("field3", 3.14); + + point.removeField("field1") + .removeField("field2"); + + Assertions.assertThat(point.getField("field1")).isNull(); + Assertions.assertThat(point.getField("field2")).isNull(); + Assertions.assertThat(3.14).isEqualTo(point.getField("field3")); + } + + @Test + void getFieldNames() { + Point point = Point.measurement("measurement") + .setField("field", 42) + .setField("123", "value") + .setField("some_name", 3.14); + + Assertions.assertThat(point.getFieldNames()) + .isEqualTo(new String[]{"123", "field", "some_name"}); + } + @Test void toLineProtocol() { Point point = Point.measurement("measurement") diff --git a/src/test/java/com/influxdb/v3/client/PointValuesTest.java b/src/test/java/com/influxdb/v3/client/PointValuesTest.java index c205fdf..a6028f2 100644 --- a/src/test/java/com/influxdb/v3/client/PointValuesTest.java +++ b/src/test/java/com/influxdb/v3/client/PointValuesTest.java @@ -30,6 +30,19 @@ import org.junit.jupiter.api.Test; public class PointValuesTest { + @Test + void asPoint() { + PointValues pointValues = new PointValues() + .setTag("tag1", "value1") + .setField("field1", 42); + + Point point = pointValues.asPoint("measurement"); + + Assertions.assertThat(pointValues.getMeasurement()).isEqualTo(point.getMeasurement()); + Assertions.assertThat(pointValues.getTag("tag1")).isEqualTo(point.getTag("tag1")); + Assertions.assertThat(pointValues.getField("field1")).isEqualTo(point.getField("field1")); + } + @Test void setMeasurement() { PointValues pointValues = PointValues.measurement("measurement"); @@ -64,6 +77,74 @@ void setTags() { Assertions.assertThat("value2").isEqualTo(pointValues.getTag("tag2")); } + @Test + void removeTag() { + PointValues pointValues = PointValues.measurement("measurement") + .setTag("tag1", "value1") + .setTag("tag2", "value2"); + + pointValues.removeTag("tag1"); + pointValues.removeTag("tagNonExistent"); + + Assertions.assertThat(pointValues.getTag("tag1")).isNull(); + Assertions.assertThat(pointValues.getTag("tag2")).isEqualTo("value2"); + } + + @Test + void getTagNames() { + PointValues pointValues = PointValues.measurement("measurement") + .setTag("tag1", "value1") + .setTag("tag2", "value2"); + + Assertions.assertThat(pointValues.getTagNames()).isEqualTo(new String[]{"tag1", "tag2"}); + } + + @Test + void setGetTypeField() { + PointValues pointValues = PointValues.measurement("measurement"); + + double floatValue = 2.71; + long integerValue = 64L; + boolean booleanValue = true; + String stringValue = "text"; + + pointValues.setFloatField("floatField", floatValue); + pointValues.setIntegerField("integerField", integerValue); + pointValues.setBooleanField("booleanField", booleanValue); + pointValues.setStringField("stringField", stringValue); + + Assertions.assertThat(pointValues.getFloatField("floatField")).isEqualTo(floatValue); + Assertions.assertThat(pointValues.getIntegerField("integerField")).isEqualTo(integerValue); + Assertions.assertThat(pointValues.getBooleanField("booleanField")).isEqualTo(booleanValue); + Assertions.assertThat(pointValues.getStringField("stringField")).isEqualTo(stringValue); + } + + @Test + void fieldGenerics() { + PointValues pointValues = PointValues.measurement("measurement"); + + double floatValue = 2.71; + long integerValue = 64L; + boolean booleanValue = true; + String stringValue = "text"; + + pointValues.setField("floatField", floatValue); + pointValues.setField("integerField", integerValue); + pointValues.setField("booleanField", booleanValue); + pointValues.setField("stringField", stringValue); + + Assertions.assertThat(pointValues.getField("floatField", Double.class)).isEqualTo(floatValue); + Assertions.assertThat(pointValues.getFieldType("floatField")).isEqualTo(Double.class); + Assertions.assertThat(pointValues.getField("integerField", Long.class)).isEqualTo(integerValue); + Assertions.assertThat(pointValues.getFieldType("integerField")).isEqualTo(Long.class); + Assertions.assertThat(pointValues.getField("booleanField", Boolean.class)).isEqualTo(booleanValue); + Assertions.assertThat(pointValues.getFieldType("booleanField")).isEqualTo(Boolean.class); + Assertions.assertThat(pointValues.getField("stringField", String.class)).isEqualTo(stringValue); + Assertions.assertThat(pointValues.getFieldType("stringField")).isEqualTo(String.class); + Assertions.assertThat(pointValues.getField("Missing", String.class)).isNull(); + Assertions.assertThat(pointValues.getFieldType("Missing")).isNull(); + } + @Test void setFields() { PointValues pointValues = PointValues.measurement("measurement"); @@ -77,6 +158,32 @@ void setFields() { Assertions.assertThat(3.14).isEqualTo(pointValues.getField("field3")); } + @Test + void removeField() { + PointValues pointValues = PointValues.measurement("measurement") + .setField("field1", 42) + .setField("field2", "value") + .setField("field3", 3.14); + + pointValues.removeField("field1") + .removeField("field2"); + + Assertions.assertThat(pointValues.getField("field1")).isNull(); + Assertions.assertThat(pointValues.getField("field2")).isNull(); + Assertions.assertThat(3.14).isEqualTo(pointValues.getField("field3")); + } + + @Test + void getFieldNames() { + PointValues pointValues = PointValues.measurement("measurement") + .setField("field", 42) + .setField("123", "value") + .setField("some_name", 3.14); + + Assertions.assertThat(pointValues.getFieldNames()) + .isEqualTo(new String[]{"123", "field", "some_name"}); + } + @Test void copy() { PointValues pointValues = PointValues.measurement("measurement")