B
B
Biaci_Anj2021-09-04 14:11:56
Java
Biaci_Anj, 2021-09-04 14:11:56

Can you use underscores in test methods?

For example,
addVote_timeValidAndVotePresent_updateVote()
methodName_stateUnderTest_expectedBehavior
Or is this against the convention and it's not allowed?

Methods should be verbs, in mixed case with the first letter lowercase, with the first letter of each internal word capitalized.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Orkhan, 2021-09-04
Hasanly @azerphoenix

Yes, you can.
Details here:
https://dzone.com/articles/7-popular-unit-test-naming
And using underscores outside of tests is not recommended.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question