feat: unchecked exceptions for start and stop functions
See original GitHub issueHi, thanks for writing this library. I tried to use it because I needed this functionality, but had to give up and look at alternatives. But I can provide you some feedback:
-
in
MockOAuth2Server
, bothstart
andshutdown
throw checked exceptions. This is not a problem in Kotlin, but it is a major PITA in Java. having to wrap intry/catch
all their use is not so great when writing tests -
no JavaDocs on any of the methods in
MockOAuth2Server
, which unfortunately makes this library nearly unusable, unless one study its source code
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Unchecked Exceptions — The Controversy
This Java tutorial describes exceptions, basic input/output, concurrency, regular expressions, and the platform environment.
Read more >How to Handle Checked & Unchecked Exceptions in Java
A checked exception must be handled either by re-throwing or with a try catch block, a runtime isn't required to be handled. An...
Read more >Checked and Unchecked Exceptions in Java - Baeldung
In general, checked exceptions represent errors outside the control of the program. For example, the constructor of FileInputStream throws ...
Read more >Implement Custom Exceptions in Java: Why, When and How
Learn 4 best practices for custom exceptions in Java. Understand when and how to use them in your application.
Read more >Checked vs Unchecked Exceptions in Java - GeeksforGeeks
Exception is an unwanted or unexpected event, which occurs during the execution of a program, i.e. at run time, that disrupts the normal ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello again.
Good and good. yes it makes sense. But you can get the port by
server.port()
?Could put the documentation issue in it own issue, and we call this something else 😃
Hi,
1 yes, just having alternative start/stop methods that do not throw checked exceptions (eg by wrapping them in
RuntimeException
) would be enough. Not sure though which names would be best for these new functions. Adding to this, would be also be good to have a method to start the mocked server on an ephemeral port, and then return the actual bound port. Right now could usestart(0)
, but then it is unclear how to read back the bound port2 sorry to say, but can’t really write documentation for an API I haven’t written… unless I study in details all the source code. Furthermore, it is also a matter of making sure that the generated jar for the JavaDocs gets created and uploaded on Maven Central (I have done it in Maven, but not much experience with Gradle…)