Skip to content

Add @DisplayName to Test Methods in Practice Exercises聽#2971

Description

@jagdish-15

馃摑 Issue Description

This issue aims to add @DisplayName() annotations for every test method in the test files of all practice exercises in the Java track.

馃敡 What You Need to Do

  1. Skip unsynced exercises:
    Before starting, make sure the exercise is not listed among the ones with unsynced tests in issue #2959.

  2. Locate the test file:

    • Go to the exercise folder inside exercises/practice/<exercise-name>/src/test.
    • Open the Java test file (typically named <ExerciseName>Test.java).
  3. Find the canonical source:

    • Navigate to the problem-specifications repo.
    • Open the corresponding exercise folder and locate canonical-data.json.
  4. Match and annotate tests:

    • The test cases in the .json file are listed in a specific order.
    • Match the tests in the Java file with the ones in canonical-data.json.
    • For each test, copy the "description" and use it as a @DisplayName("") annotation above the corresponding method in the Java test file.

鈿狅笍 Important Guidelines

  • Max 15 exercises per PR:
    To avoid large PRs, limit the number of exercises being updated in each PR to a maximum of 15 exercises (less is ok too).

  • Do not close this issue via PRs:
    Avoid referencing this issue in your PR with terms like Fixes #XXX or Resolves #XXX, since this would automatically close the issue.

  • Avoid reimplemented exercises:
    Make sure you are not copying descriptions from tests that have been reimplemented.

  • Need help?
    If you have any questions, feel free to ask in the comments!


馃搵 Checklist of Practice Exercises

  • acronym
  • affine-cipher
  • all-your-base
  • allergies
  • alphametics
  • anagram
  • armstrong-numbers
  • atbash-cipher
  • bank-account
  • binary-search-tree
  • binary-search
  • bob
  • book-store
  • bottle-song
  • bowling
  • change
  • circular-2buffer
  • clock
  • collatz-conjecture
  • complex-numbers
  • connect
  • crypto-square
  • custom-set
  • darts
  • diamond
  • difference-of-squares
  • dnd-character
  • dominoes
  • dot-dsl
  • eliuds-eggs
  • error-handling
  • etl
  • flatten-array
  • flower-field
  • food-chain
  • forth
  • game-of-life
  • gigasecond
  • go-counting
  • grade-school
  • grains
  • grep
  • hamming
  • hangman
  • hello-world
  • high-scores
  • house
  • isbn-verifier
  • isogram
  • killer-sudoku-helper
  • kindergarten-garden
  • knapsack
  • largest-series-product
  • leap
  • ledger
  • linked-list
  • list-ops
  • luhn
  • markdown
  • matching-brackets
  • matrix
  • mazy-mice
  • meetup
  • micro-blog
  • nth-prime
  • nucleotide-count
  • ocr-numbers
  • palindrome-products
  • pangram
  • parallel-letter-frequency
  • pascals-triangle
  • perfect-numbers
  • phone-number
  • piecing-it-together
  • pig-latin
  • poker
  • pov
  • prime-factors
  • protein-translation
  • proverb
  • pythagorean-triplet
  • queen-attack
  • rail-fence-cipher
  • raindrops
  • rational-numbers
  • react
  • rectangles
  • relative-distance
  • resistor-color-duo
  • resistor-color-trio
  • resistor-color
  • rest-api
  • reverse-string
  • rna-transcription
  • robot-name
  • robot-simulator
  • roman-numerals
  • rotational-cipher
  • run-length-encoding
  • saddle-points
  • satellite
  • say
  • scrabble-score
  • secret-handshake
  • series
  • sgf-parsing
  • sieve
  • simple-cipher
  • simple-linked-list
  • space-age
  • spiral-matrix
  • square-root
  • state-of-tic-tac-toe
  • sublist
  • sum-of-multiples
  • swift-scheduling
  • tournament
  • transpose
  • tree-building
  • triangle
  • twelve-days
  • two-bucket
  • two-fer
  • variable-length-quantity
  • word-count
  • word-search
  • wordy
  • yacht
  • zebra-puzzle
  • zipper

馃挕 Reference Example

To understand how to properly add @DisplayName annotations based on canonical-data.json, you can refer to the test file in the Swift Scheduling exercise.

It already includes correctly formatted @DisplayName entries matching the test case descriptions, making it a good template for how your test file should look after the changes.

Activity

  1. EmmanuelBerkowicz commented on Jul 8, 2025

    @EmmanuelBerkowicz
    Contributor

    Hi @kahgoh & @jagdish-15

    My name is Emmanuel and I'm relatively new to open source contributions. This looks like an excellent opportunity for me to improve my Java skills while contributing to Exercism, which has been incredibly helpful in my TypeScript learning journey.
    I'd love to work on this issue and would appreciate being assigned to it. I understand the guidelines about:

    I'm planning to start with a smaller batch (maybe 5-10 exercises) for my first PR to get comfortable with the workflow, then continue with additional PRs as needed.
    Could you please assign me to this issue? I'm excited to contribute and help improve the Java track's test documentation!
    Thanks!

  2. kahgoh commented on Jul 8, 2025

    @kahgoh
    Member

    Thanks for taking this on @EmmanuelBerkowicz! I have just assigned this one to you.

  3. added a commit that references this issue on Jul 13, 2025
  4. EmmanuelBerkowicz commented on Jul 15, 2025

    @EmmanuelBerkowicz
    Contributor

    Hey @kahgoh ,
    I've not used IntelliJ CheckStyle before.
    It looks like that is the reason my pull request is not going through (ref attached image).
    I've restarted my IDE with the plugin installed, and it's not showing anything different.
    Is there anything obvious I might have overlooked or can do to push this through?

    Image
  5. kahgoh commented on Jul 15, 2025

    @kahgoh
    Member

    Sorry I'm not familar with the IntelliJ plugin, but I wonder if you need to do something to run it. With Gradle, you should also be to run it with ./gradlew check.

    In terms of the error in the CI, this is specific error:

    Error: eckstyle] [ERROR] /home/runner/work/java/java/exercises/practice/swift-scheduling/src/test/java/SwiftSchedulingTest.java:131: Line is longer than 120 characters (found 124). [LineLength]
    
  6. jagdish-15 commented on Jul 15, 2025

    @jagdish-15
    MemberAuthor

    I've also added a few comments on the PR regarding this error!

  7. EmmanuelBerkowicz commented on Jul 22, 2025

    @EmmanuelBerkowicz
    Contributor

    Thanks guys!
    I've committed the suggested change :)

  8. added a commit that references this issue on Jul 22, 2025
  9. jagdish-15 commented on Jul 22, 2025

    @jagdish-15
    MemberAuthor

    @EmmanuelBerkowicz,
    The PR is merged now! You can now start working on other exercises.

  10. EmmanuelBerkowicz commented on Aug 3, 2025

    @EmmanuelBerkowicz
    Contributor

    hey @jagdish-15 ,
    Is this closed?

  11. 20 remaining items

  12. jagdish-15 commented on Nov 17, 2025

    @jagdish-15
    MemberAuthor

    @manjarekarsudip

    Yes, the issue is still active, and the list is up-to-date. You can raise a PR for any exercises not already checked off, unless there鈥檚 an existing PR for them (there aren鈥檛 any at the moment).
    I鈥檒l assign this issue to you as well!

  13. dsaladbar617 commented on Nov 18, 2025

    @dsaladbar617
    Contributor

    Hello, I will be looking through the list as well and plan to drop a pr for this as well. I don't know if it needs to be assigned to me, but willing to take it.

  14. added a commit that references this issue on Nov 18, 2025
  15. added a commit that references this issue on Nov 23, 2025
  16. Mihir0106 commented on Dec 1, 2025

    @Mihir0106

    @jagdish-15 Is it ok if i join in this issue task as well?

  17. added a commit that references this issue on Dec 11, 2025
  18. added a commit that references this issue on Dec 11, 2025
  19. Baboushka commented on Dec 13, 2025

    @Baboushka
    Contributor

    Hello @jagdish-15, I'll push a PR for the remaining zipper exercice, since the others seem to be merged already.

  20. jagdish-15 commented on Dec 13, 2025

    @jagdish-15
    MemberAuthor

    #3064 This is intended to be the final PR for this issue. I picked it up myself because the problem-specifications repo didn鈥檛 have a canonical-data.json file. I鈥檇 appreciate your review, @kahgoh.

  21. jagdish-15 commented on Dec 17, 2025

    @jagdish-15
    MemberAuthor

    Thanks everyone for the contributions! The last PR completes everything, so we can close this issue.

  22. added 2 commits that reference this issue on Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions