Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better NotImplementedError handling in tests #233

Merged
merged 1 commit into from
Jul 17, 2024

Conversation

Daoortor
Copy link
Collaborator

Now students will get more useful error messages in case NotImplementedError occurs. There are three cases:

  1. A non-implemented function is called directly from main().
  2. A function is not implemented, but it should be.
  3. A function shouldn't be implemented, but it's called.

Copy link
Collaborator

@mikrise2 mikrise2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good Job! Just one small comment about code style. In general you wrote what I wanted to see.


class HandleNotImplementedErrorExtension : TestExecutionExceptionHandler {
override fun handleTestExecutionException(context: ExtensionContext, throwable: Throwable): Nothing = if (throwable.javaClass.name == "kotlin.NotImplementedError") {
val notImplementedMethodName = throwable.stackTrace[0].methodName
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to use first() instead of [0].

@Daoortor Daoortor merged commit 7f3d35a into jetbrains-academy:main Jul 17, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants