From 3ea9016da1201478ecc357bfaca6690f69c44eb3 Mon Sep 17 00:00:00 2001 From: zhangjiawei <349071347@qq.com> Date: Sat, 30 Dec 2023 22:30:49 +0800 Subject: [PATCH] optimize spring autoconfigure server unit test --- .../server/store/StorePropertiesTest.java | 8 ++++++++ .../server/store/StoreRedisPropertiesTest.java | 14 ++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/store/StorePropertiesTest.java b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/store/StorePropertiesTest.java index 031821d2e78..c725d7586bd 100644 --- a/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/store/StorePropertiesTest.java +++ b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/store/StorePropertiesTest.java @@ -29,7 +29,15 @@ public void testStoreProperties() { storeProperties.setMode("mode"); storeProperties.setPublicKey("public"); + StoreProperties.Session session = new StoreProperties.Session(); + session.setMode("mode"); + + StoreProperties.Lock lock = new StoreProperties.Lock(); + lock.setMode("mode"); + Assertions.assertEquals("mode", storeProperties.getMode()); Assertions.assertEquals("public", storeProperties.getPublicKey()); + Assertions.assertEquals("mode", session.getMode()); + Assertions.assertEquals("mode", lock.getMode()); } } diff --git a/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/store/StoreRedisPropertiesTest.java b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/store/StoreRedisPropertiesTest.java index 29ea0ebc90f..c61ddb6a527 100644 --- a/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/store/StoreRedisPropertiesTest.java +++ b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/io/seata/spring/boot/autoconfigure/properties/server/store/StoreRedisPropertiesTest.java @@ -43,5 +43,19 @@ public void testStoreRedisProperties() { Assertions.assertEquals(1, storeRedisProperties.getMinConn()); Assertions.assertEquals(1, storeRedisProperties.getQueryLimit()); Assertions.assertEquals(1, storeRedisProperties.getMaxTotal()); + + StoreRedisProperties.Single single = new StoreRedisProperties.Single(); + single.setHost("host"); + single.setPort(80); + Assertions.assertEquals("host", single.getHost()); + Assertions.assertEquals(80, single.getPort()); + + StoreRedisProperties.Sentinel sentinel = new StoreRedisProperties.Sentinel(); + sentinel.setSentinelHosts("host"); + sentinel.setMasterName("master"); + sentinel.setSentinelPassword("pwd"); + Assertions.assertEquals("host", sentinel.getSentinelHosts()); + Assertions.assertEquals("master", sentinel.getMasterName()); + Assertions.assertEquals("pwd", sentinel.getSentinelPassword()); } }