Skip to content

Commit e59bb6e

Browse files
committed
Final push... again... fixed mock url for testing...
1 parent ac2dccc commit e59bb6e

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/main/java/com/example/HelloModel.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ public HelloModel() {
2626
}
2727
}
2828

29+
public HelloModel(String topicUrl) {
30+
if (topicUrl == null || topicUrl.isBlank()) {
31+
throw new IllegalStateException("NTFY_URL not found in .env file");
32+
}
33+
this.TOPIC_URL = topicUrl;
34+
}
35+
2936
public void sendMessage(String username, String message) throws IOException {
3037
JSONObject json = new JSONObject();
3138
json.put("username", username == null || username.isBlank() ? "Anonymous" : username);

src/test/java/com/example/HelloModelTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class HelloModelTest {
1717

1818
@BeforeEach
1919
void setUp() {
20-
model = new HelloModel() {
20+
model = new HelloModel("https://dummy-url-for-tests") {
2121
@Override
2222
protected void sendJsonToNtfy(JSONObject json) {
2323
System.out.println("Mock sendJsonToNtfy called: " + json);

0 commit comments

Comments
 (0)