Add `@DisplayName` to Test Methods in Practice Exercises
📝 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
-
Skip unsynced exercises:
Before starting, make sure the exercise is not listed among the ones with unsynced tests in issue #2959. -
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).
- Go to the exercise folder inside
-
Find the canonical source:
- Navigate to the problem-specifications repo.
- Open the corresponding exercise folder and locate
canonical-data.json.
-
Match and annotate tests:
- The test cases in the
.jsonfile 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.
- The test cases in the
⚠️ 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 likeFixes #XXXorResolves #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
- [x] acronym
- [x] affine-cipher
- [x] all-your-base
- [x] allergies
- [x] alphametics
- [x] anagram
- [x] armstrong-numbers
- [x] atbash-cipher
- [x] bank-account
- [x] binary-search-tree
- [x] binary-search
- [x] bob
- [x] book-store
- [x] bottle-song
- [x] bowling
- [x] change
- [x] circular-2buffer
- [x] clock
- [x] collatz-conjecture
- [x] complex-numbers
- [x] connect
- [x] crypto-square
- [x] custom-set
- [x] darts
- [x] diamond
- [x] difference-of-squares
- [x] dnd-character
- [x] dominoes
- [x] dot-dsl
- [x] eliuds-eggs
- [x] error-handling
- [x] etl
- [x] flatten-array
- [x] flower-field
- [x] food-chain
- [x] forth
- [x] game-of-life
- [x] gigasecond
- [x] go-counting
- [x] grade-school
- [x] grains
- [x] grep
- [x] hamming
- [x] hangman
- [x] hello-world
- [x] high-scores
- [x] house
- [x] isbn-verifier
- [x] isogram
- [x] killer-sudoku-helper
- [x] kindergarten-garden
- [x] knapsack
- [x] largest-series-product
- [x] leap
- [x] ledger
- [x] linked-list
- [x] list-ops
- [x] luhn
- [x] markdown
- [x] matching-brackets
- [x] matrix
- [x] mazy-mice
- [x] meetup
- [x] micro-blog
- [x] nth-prime
- [x] nucleotide-count
- [x] ocr-numbers
- [x] palindrome-products
- [x] pangram
- [x] parallel-letter-frequency
- [x] pascals-triangle
- [x] perfect-numbers
- [x] phone-number
- [x] piecing-it-together
- [x] pig-latin
- [x] poker
- [x] pov
- [x] prime-factors
- [x] protein-translation
- [x] proverb
- [x] pythagorean-triplet
- [x] queen-attack
- [x] rail-fence-cipher
- [x] raindrops
- [x] rational-numbers
- [x] react
- [x] rectangles
- [x] relative-distance
- [x] resistor-color-duo
- [x] resistor-color-trio
- [x] resistor-color
- [x] rest-api
- [x] reverse-string
- [x] rna-transcription
- [x] robot-name
- [x] robot-simulator
- [x] roman-numerals
- [x] rotational-cipher
- [x] run-length-encoding
- [x] saddle-points
- [x] satellite
- [x] say
- [x] scrabble-score
- [x] secret-handshake
- [x] series
- [x] sgf-parsing
- [x] sieve
- [x] simple-cipher
- [x] simple-linked-list
- [x] space-age
- [x] spiral-matrix
- [x] square-root
- [x] state-of-tic-tac-toe
- [x] sublist
- [x] sum-of-multiples
- [x] swift-scheduling
- [x] tournament
- [x] transpose
- [x] tree-building
- [x] triangle
- [x] twelve-days
- [x] two-bucket
- [x] two-fer
- [x] variable-length-quantity
- [x] word-count
- [x] word-search
- [x] wordy
- [x] yacht
- [x] zebra-puzzle
- [x] 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.
Hi @jagdish-15 is currently work going on for this issue? It seems many have just stopped the work in between after few merges, like not able to see any thing in recent 1 month. Is it ok if i join in this issue task as well? And please confirm whether the current check list which is there in the description are yet to be changed as per requirement because i see few PRs are merged.
@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’s an existing PR for them (there aren’t any at the moment). I’ll assign this issue to you as well!
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.
@jagdish-15 Is it ok if i join in this issue task as well?
Hello @jagdish-15, I'll push a PR for the remaining zipper exercice, since the others seem to be merged already.
#3064 This is intended to be the final PR for this issue. I picked it up myself because the problem-specifications repo didn’t have a canonical-data.json file. I’d appreciate your review, @kahgoh.
Thanks everyone for the contributions! The last PR completes everything, so we can close this issue.