From 6bf8a382d849c820247284ef773b3fd01b066a72 Mon Sep 17 00:00:00 2001 From: kale Date: Fri, 5 Dec 2025 05:16:36 -0500 Subject: [PATCH] =?UTF-8?q?[fix]:[=E6=B7=BB=E5=8A=A0java=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E4=BB=A3=E7=A0=81]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 8 ++++++++ src/main/java/com/example/App.java | 5 +++++ src/test/java/com/example/AppTest.java | 8 ++++++++ 3 files changed, 21 insertions(+) create mode 100644 src/test/java/com/example/AppTest.java diff --git a/pom.xml b/pom.xml index c921cec..3668646 100644 --- a/pom.xml +++ b/pom.xml @@ -11,4 +11,12 @@ 17 17 + + + org.junit.jupiter + junit-jupiter + 5.12.2 + test + + \ No newline at end of file diff --git a/src/main/java/com/example/App.java b/src/main/java/com/example/App.java index 594d998..a6e9422 100644 --- a/src/main/java/com/example/App.java +++ b/src/main/java/com/example/App.java @@ -4,5 +4,10 @@ public class App { public static void main(String[] args) { System.out.println("Hello, World!"); } + + public String greet() { + return "Hello, World!"; + } + } diff --git a/src/test/java/com/example/AppTest.java b/src/test/java/com/example/AppTest.java new file mode 100644 index 0000000..acec55a --- /dev/null +++ b/src/test/java/com/example/AppTest.java @@ -0,0 +1,8 @@ +package com.example; + +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.*; + +public class AppTest { + @Test public void testGreet() { App app = new App(); assertEquals("Hello, World!", app.greet()); } +}