File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff 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 );
Original file line number Diff line number Diff 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 );
You can’t perform that action at this time.
0 commit comments