reset password
Author Message
alope415
Posts: 12
Posted 18:10 Apr 04, 2017 |

I got 2 questions that are bothering me about this lab. I don't know if I'm allowed to ask them but I'll do it anyway. Thank you.

1.) What kind of method does .equals() have to be? Does it have to be a boolean method where it returns a true or false?
2.) The instructions say to test ALL methods. Assuming we are allowed to make another method in our class other than constructor, add/subtract/multiply/divide, equals(), and toString(), do we have to do a JUnit test on that method?

nickdrakesi
Posts: 11
Posted 18:19 Apr 04, 2017 |

1.) This should be a boolean. John's instructions are to check if objects are the same, using your created equals(), therefore, it makes sense to use it as a boolean since this is similar to Java's Object library listed here: https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html

2.) All "good" code is test driven, meaning for this case, you write the test before you write the code. Therefore all methods that are written, are written because you have an idea of testing them. 

 

TL;DR:

1.) Should return boolean.

2.) Test all methods you create because his instructions are to be extensive, and also to check if you have any bugs. 

 

Last edited by nickdrakesi at 19:18 Apr 04, 2017.
alope415
Posts: 12
Posted 19:08 Apr 04, 2017 |

Alright, thanks mate.

nickdrakesi
Posts: 11
Posted 19:19 Apr 04, 2017 |
alope415 wrote:

Alright, thanks mate.

No problem! yessmiley

jhurley
Posts: 207
Posted 09:12 Apr 05, 2017 |

well put