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

StructuralTestProvider: provide better feedback for classes expected in the default package #293

Closed
martinmo opened this issue May 17, 2023 · 3 comments
Assignees
Labels
bug Something isn't working structural-tests Components related to de.tum.in.test.api.structural

Comments

@martinmo
Copy link

Is your feature request related to a problem? Please describe.
If a class is expected in the default package, e.g., with the following test.json snippet:

[
  {
    "class": {
      "name": "SomeClass",
      "package": ""
    }
  }
]

and cannot be found (or is misplaced), the error message will read: "The exercise expects a class with the name SomeClass in the package . You did not implement the class in the exercise."

Describe the solution you'd like
I think the error message should look like:

- The exercise expects a class with the name SomeClass in the package . You did not implement the class in the exercise.
+ The exercise expects a class with the name SomeClass in the default package. You did not implement the class in the exercise.

And, maybe, to mitigate that beginners then try to add package default; at the beginning of their Java files, one could even go further:

- The exercise expects a class with the name SomeClass in the package . You did not implement the class in the exercise.
+ The exercise expects a class with the name SomeClass in the default package (i.e., no package). You did not implement the class in the exercise.

Describe alternatives you've considered

  • Adding a special hint in the problem statement.
  • Providing class templates in the template repository.
  • Changing the exercise to not use the default package. However, for beginner exercises it's actually nice to skip as many distractions as possible.

Additional context
This is only affects very basic Java programming exercises w/o packages.

Ares-Version you are using
1.11.3

@MaisiKoleni MaisiKoleni added bug Something isn't working structural-tests Components related to de.tum.in.test.api.structural labels May 20, 2023
@MaisiKoleni
Copy link
Collaborator

Would The exercise expects a class with the name SomeClass in the package <default> (i.e., no package). You did not implement the class in the exercise. be OK? I would choose that implementation, as it does not require reordering in the messages or grammatical adjustments:

  • default package
  • package net.example.test

It should address the problem for now, that the package name is just an empty string.
If this solution does not meet your needs, feel free to reopen the ticket and preferably open a pull request with your suggestion.

@MaisiKoleni MaisiKoleni self-assigned this Jun 22, 2023
@MaisiKoleni MaisiKoleni added this to the Version 1.12.0 milestone Jun 22, 2023
@MaisiKoleni
Copy link
Collaborator

Will be fixed in version 1.12.0.

Thanks for reposting and creating the bug report!

@martinmo
Copy link
Author

This solution is sufficient. Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working structural-tests Components related to de.tum.in.test.api.structural
Projects
None yet
Development

No branches or pull requests

2 participants