#JUnit help

1 messages · Page 1 of 1 (latest)

jaunty trail
#

Hey guys. Currently having troubles with passing this JUnit test. The instruction specify to make sure n is not negative by throwing an Illegal Argument exception so that is what i did. Don't know why i cannot pass that test.

The Test file was made by my professor

lavish flumeBOT
#

<@&987246399047479336> please have a look, thanks.

lavish flumeBOT
#

While you are waiting for getting help, here are some tips to improve your experience:

Code is much easier to read if posted with syntax highlighting and proper formatting.

If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.

Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.

jaunty trail
#

i feel like something is off about that test

#

here is the method that i did

north abyss
#

you're checking the exception message

tender aurora
#

In your code, you are using a certain message

#

In your test you are checking a message totally different

#

Like

jaunty trail
#

is it okay if i changed the message that the test gives us??

#

i ended up doing that because that error message given by the test does not make much sense to me

tender aurora
#

In your code, your message is [ERROR]: n must be positive
And in your test, the message is negative number -7

#

They do not match

jaunty trail
tender aurora
#

If make two different strings, don't expect them to be equal

north abyss
#

but in this particular test you pass -7