0

When running unitTest on AndroidStudio (1.4), my below test fail as per title i.e. java.lang.NoSuchMethodError: org.assertj.core.api.Assertions.assertThat(Ljava/util/Map;)Lorg/assertj/core/api/MapAssert;

@Test
public void mapTest() {
    Map<String, String> map = new HashMap<>();
    map.put("Key1", "Value1");
    map.put("Key2", "Value2");
    Assertions.assertThat(map).isNotNull();
}

When I run it from command line using gradlew command, it passed. I'm already pointing my Java to jdk1.8.0_66.jdk. Anyone knows why?

(p/s: I get the latest AndroidStudio 2.0 Preview 5, my test fails massively. So I decided to stay with the older version of Android Studio).

Trying to search for help and found this link https://github.com/joel-costigliola/assertj-core/issues/395. Apparently he also face the same issue on IDE. Any clue what's the cause?

Elye
  • 53,639
  • 54
  • 212
  • 474

1 Answers1

0

I would double check the classpath. Use assertj core 1.7.1 - it's a version depending on java 6 whcih I'm sure is Android compatible.

Hope it helps

Joel Costigliola
  • 6,308
  • 27
  • 35