Fixing My Overrided .equals()

My mentor, Dr. Jim Bowring, informed me that what I did to override .equals() worked but was not the way I was intended to do it. That wasn’t too hard of a fix after he walked me through it. The logic is now easier to read and explain to others.

Writing JUnit Tests

The first tests I made were tests to check if the attributes between the original instance of the Pokemon class matched the second instance that was made from the PokeDex.csv file that contains the attributes of the original instance. I did this by making getters for each attribute and then making tests for each attribute and using assertEquals() to check if each attribute was equal to the other instance of the Pokemon class. It all runs how intended but, I wouldn’t be surprised if there is a better way to do it.

Articles

Java equals() and hashCode() Contracts
A Guide to JUnit 5
Assertions in JUnit 4 and JUnit 5