-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from mbland/servlet-dependency-injection
Implement Servlet.doPost with TempStringCalculator
- Loading branch information
Showing
11 changed files
with
571 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
strcalc/src/main/java/com/mike_bland/training/testing/stringcalculator/StringCalculator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.mike_bland.training.testing.stringcalculator; | ||
|
||
public interface StringCalculator { | ||
class Exception extends java.lang.Exception { | ||
public Exception(String message) { | ||
super(message); | ||
} | ||
} | ||
|
||
int add(String numbers) throws Exception; | ||
} |
19 changes: 19 additions & 0 deletions
19
...main/java/com/mike_bland/training/testing/stringcalculator/TemporaryStringCalculator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.mike_bland.training.testing.stringcalculator; | ||
|
||
import jakarta.enterprise.context.ApplicationScoped; | ||
|
||
@ApplicationScoped | ||
public class TemporaryStringCalculator implements StringCalculator { | ||
public static class Exception extends StringCalculator.Exception { | ||
public Exception(String numbers) { | ||
super(String.format( | ||
"TemporaryStringCalculator received: \"%s\"", numbers | ||
)); | ||
} | ||
} | ||
|
||
@Override | ||
public int add(String numbers) throws Exception { | ||
throw new Exception(numbers); | ||
} | ||
} |
Oops, something went wrong.