From ca1e0150d72bc12986f8e920252ee5a4d7dee2b6 Mon Sep 17 00:00:00 2001 From: Seongho Bae Date: Thu, 13 Aug 2026 14:06:03 +0900 Subject: [PATCH] test(eureka): reproduce bootstrap documentation gap on live develop --- .../EurekaServerApplicationContractTest.java | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 eureka-server/src/test/java/com/xtrmetl/eureka/EurekaServerApplicationContractTest.java diff --git a/eureka-server/src/test/java/com/xtrmetl/eureka/EurekaServerApplicationContractTest.java b/eureka-server/src/test/java/com/xtrmetl/eureka/EurekaServerApplicationContractTest.java new file mode 100644 index 00000000..89f4bd7b --- /dev/null +++ b/eureka-server/src/test/java/com/xtrmetl/eureka/EurekaServerApplicationContractTest.java @@ -0,0 +1,47 @@ +package com.xtrmetl.eureka; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; + +import java.io.IOException; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; + +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +/** + * Verifies the standalone Eureka bootstrap contract and its beginner-readable public documentation. + */ +class EurekaServerApplicationContractTest { + + @Test + void bootstrapClassKeepsTheRequiredServerAnnotations() { + assertNotNull(EurekaServerApplication.class.getAnnotation(SpringBootApplication.class)); + assertNotNull(EurekaServerApplication.class.getAnnotation(EnableEurekaServer.class)); + } + + @Test + void mainEntryPointRemainsPublicStatic() throws NoSuchMethodException { + Method main = EurekaServerApplication.class.getDeclaredMethod("main", String[].class); + + assertTrue(Modifier.isPublic(main.getModifiers())); + assertTrue(Modifier.isStatic(main.getModifiers())); + } + + @Test + void publicBootstrapApiHasBeginnerReadableJavadoc() throws IOException { + String source = Files.readString( + Path.of("src/main/java/com/xtrmetl/eureka/EurekaServerApplication.java"), + StandardCharsets.UTF_8 + ); + + assertTrue(source.contains("Starts the standalone mightyETL Eureka service registry")); + assertTrue(source.contains("Launches the Eureka registry through Spring Boot")); + assertTrue(source.contains("@param args command-line arguments passed to Spring Boot")); + } +}