Skip to content

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

@jagdish-15

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.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions