se-edu/addressbook-level4

Junit test fails after adding some dependencies in build.gradle

Closed this issue · 6 comments

Hello, everyone! I am trying to import some external APIs by adding dependencies in the build.gradle file, and import changes. The tests will all pass without adding the dependencies(before the last commit) initially. The issue is that after I adding the dependencies, and no modifications to other code, but some junit tests will fail. But if I do manual testing, there seems no such errors. Does anyone know how to address this issue? Thank you!
Here is the link to the PR: CS2103JAN2018-W15-B1#60

I'm unable to resolve this issue, but I'll type out what I've found out so far:

  1. The tests fail when the first or the third line is imported.
  2. The tests fail at weird places: asserting that the result displays equal as expected (the result display keeps displaying an empty result), AddressBookSystemTest#selectPerson(Index) fails as well.
  3. This also fails on se-edu repo on master branch.

Try slightly earlier versions of the libraries? Could be an incompatibility between a latest version of the library vs our code. Another possibility is that the same class appears twice in the libraries but the two behaves slightly differently.

Hi @crizyli I have resolved this issue (at least on se-edu's master branch; I didn't verify on your branch). Simply upgrade your gradle version from 2.12 to 4.6. It seems that the Google's libraries are incompatible with the older Gradle versions.

For the exact code that you have to change, take a look here.

Please verify if it works and let me know!

Hi! @Zhiyuan-Amos Really thanks for your help! The tests can all pass without fails now. Should I close this Issue?

@crizyli awesome! :) I'll close this issue.

@damithc fyi.

Thanks for the help @Zhiyuan-Amos 💯