diff --git a/sofa-boot-project/sofa-boot/pom.xml b/sofa-boot-project/sofa-boot/pom.xml
index 2b160377f..46ea0a1d2 100644
--- a/sofa-boot-project/sofa-boot/pom.xml
+++ b/sofa-boot-project/sofa-boot/pom.xml
@@ -45,6 +45,7 @@
logback-classic
test
+
diff --git a/sofa-boot-project/sofa-boot/src/test/java/com/alipay/sofa/boot/compatibility/VerificationResultTests.java b/sofa-boot-project/sofa-boot/src/test/java/com/alipay/sofa/boot/compatibility/VerificationResultTests.java
new file mode 100644
index 000000000..664ab4a5c
--- /dev/null
+++ b/sofa-boot-project/sofa-boot/src/test/java/com/alipay/sofa/boot/compatibility/VerificationResultTests.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.alipay.sofa.boot.compatibility;
+
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * Tests for {@link VerificationResult}.
+ *
+ * @author JPSINH27
+ * @version VerificationResultTests, v 0.1 2024年03月02日 10:20 PM
+ */
+public class VerificationResultTests {
+
+ @Test
+ public void testEquals_SameDescriptionAndAction_ReturnsTrue() {
+ VerificationResult result1 = VerificationResult.notCompatible("Error", "Take action");
+ VerificationResult result2 = VerificationResult.notCompatible("Error", "Take action");
+ assertThat(result1).isEqualTo(result2);
+ }
+
+ @Test
+ public void testEquals_DifferentDescriptions_ReturnsFalse() {
+ VerificationResult result1 = VerificationResult.notCompatible("Error 1", "Take action");
+ VerificationResult result2 = VerificationResult.notCompatible("Error 2", "Take action");
+ assertThat(result1).isNotEqualTo(result2);
+ }
+
+ @Test
+ public void testEquals_DifferentActions_ReturnsFalse() {
+ VerificationResult result1 = VerificationResult.notCompatible("Error", "Take action 1");
+ VerificationResult result2 = VerificationResult.notCompatible("Error", "Take action 2");
+ assertThat(result1).isNotEqualTo(result2);
+ }
+
+ @Test
+ public void testEquals_ComparingWithNull_ReturnsFalse() {
+ VerificationResult result1 = VerificationResult.notCompatible("Error", "Take action");
+ assertThat(result1).isNotEqualTo(null);
+ }
+}
\ No newline at end of file
diff --git a/sofa-boot-project/sofa-boot/src/test/java/com/alipay/sofa/boot/startup/StartupReporterTests.java b/sofa-boot-project/sofa-boot/src/test/java/com/alipay/sofa/boot/startup/StartupReporterTests.java
new file mode 100644
index 000000000..8a405b1d5
--- /dev/null
+++ b/sofa-boot-project/sofa-boot/src/test/java/com/alipay/sofa/boot/startup/StartupReporterTests.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.alipay.sofa.boot.startup;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.springframework.context.ConfigurableApplicationContext;
+import org.springframework.core.env.ConfigurableEnvironment;
+
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+/**
+ * Tests for {@link StartupReporter}.
+ *
+ * @author JPSINH27
+ * @version StartupReporterTests.java, v 0.1 2024年01月03日 10:19 PM
+ */
+public class StartupReporterTests {
+
+ @Mock
+ ConfigurableApplicationContext mockContext;
+
+ @Mock
+ ConfigurableEnvironment mockEnvironment;
+
+ @BeforeEach
+ public void setup() {
+ MockitoAnnotations.openMocks(this);
+ }
+
+ @Test
+ public void testApplicationBootFinish() {
+ StartupReporter startupReporter = new StartupReporter();
+ assertDoesNotThrow(startupReporter::applicationBootFinish);
+ }
+
+ @Test
+ public void testAddCommonStartupStat() {
+ StartupReporter startupReporter = new StartupReporter();
+ BaseStat baseStat = new BaseStat();
+ assertDoesNotThrow(() -> {
+ startupReporter.addCommonStartupStat(baseStat);
+ });
+ }
+
+ @Test
+ public void testDrainStartupStaticsModel() {
+ StartupReporter startupReporter = new StartupReporter();
+ assertNotNull(startupReporter.drainStartupStaticsModel());
+ }
+
+}
\ No newline at end of file
diff --git a/sofa-boot-project/sofa-boot/src/test/java/com/alipay/sofa/boot/util/SofaBootEnvUtilsTests.java b/sofa-boot-project/sofa-boot/src/test/java/com/alipay/sofa/boot/util/SofaBootEnvUtilsTests.java
index 8e8d8aad1..29b8e84e3 100644
--- a/sofa-boot-project/sofa-boot/src/test/java/com/alipay/sofa/boot/util/SofaBootEnvUtilsTests.java
+++ b/sofa-boot-project/sofa-boot/src/test/java/com/alipay/sofa/boot/util/SofaBootEnvUtilsTests.java
@@ -19,6 +19,8 @@
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
/**
* Tests for {@link SofaBootEnvUtils}.
@@ -49,4 +51,38 @@ public void testEnv() {
public void arkEnv() {
assertThat(SofaBootEnvUtils.isArkEnv()).isFalse();
}
+
+ @Test
+ void testIsSpringCloudBootstrapEnvironment_NullEnvironment() {
+ assertFalse(SofaBootEnvUtils.isSpringCloudBootstrapEnvironment(null));
+ }
+
+ @Test
+ public void testInitSpringTestEnv() {
+
+ boolean expectedTestEnv = true;
+
+ boolean actualTestEnv = isInitSpringTestEnv();
+
+ assertEquals(expectedTestEnv, actualTestEnv);
+ }
+
+ private boolean isInitSpringTestEnv() {
+ StackTraceElement[] stackTrace = new StackTraceElement[] {
+ new StackTraceElement("SomeClass", "someMethod", "SomeClass.java", 10),
+ new StackTraceElement("AnotherClass", "loadContext", "AnotherClass.java", 20),
+ new StackTraceElement(
+ "org.springframework.boot.test.context.SpringBootContextLoader", "loadContext",
+ "SpringBootContextLoader.java", 30) };
+ boolean TEST_ENV = false;
+ for (StackTraceElement stackTraceElement : stackTrace) {
+ if ("loadContext".equals(stackTraceElement.getMethodName())
+ && "org.springframework.boot.test.context.SpringBootContextLoader"
+ .equals(stackTraceElement.getClassName())) {
+ TEST_ENV = true;
+ break;
+ }
+ }
+ return TEST_ENV;
+ }
}