From f21a7263c0cc61ff3d57466cdccddfeb13118820 Mon Sep 17 00:00:00 2001 From: Sattvik Chakravarthy Date: Wed, 6 Dec 2023 20:19:08 +0530 Subject: [PATCH] fix: test defaults --- .../java/io/supertokens/test/ConfigMapperTest.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/test/java/io/supertokens/test/ConfigMapperTest.java b/src/test/java/io/supertokens/test/ConfigMapperTest.java index 437819caa..1b048020b 100644 --- a/src/test/java/io/supertokens/test/ConfigMapperTest.java +++ b/src/test/java/io/supertokens/test/ConfigMapperTest.java @@ -52,6 +52,17 @@ public static class DummyConfig { @Test public void testAllValidConversions() throws Exception { + // Test defaults + { + JsonObject config = new JsonObject(); + assertEquals(-1, ConfigMapper.mapConfig(config, DummyConfig.class).int_property); + assertEquals(-1, ConfigMapper.mapConfig(config, DummyConfig.class).long_property); + assertEquals(-1, ConfigMapper.mapConfig(config, DummyConfig.class).float_property, 0.0001); + assertEquals(-1, ConfigMapper.mapConfig(config, DummyConfig.class).double_property, 0.0001); + assertEquals("default_string", ConfigMapper.mapConfig(config, DummyConfig.class).string_property); + assertEquals(new Long(-1), ConfigMapper.mapConfig(config, DummyConfig.class).nullable_long_property); + } + // valid for int { JsonObject config = new JsonObject();