0

I'm using Spek plugin for Junit testing with Gradle build tool in the IDEA-2018.2 Here are dependency version for the above-

ext.junitPlatformVersion = '1.0.0'
ext.spekVersion = '1.1.5'

Dependency-

testRuntime "org.junit.platform:junit-platform-launcher:$junitPlatformVersion"

When running throw the ./gradlew test it tests well without any errors but when running through the Spek Run in that test file then it throws the following error-

java.lang.NoSuchMethodError: com.company.Class.method(Linput1; Linput2) Lio/reactivex/Single;

Due to the company's privacy didn't write actual class name and method. Would any help be appreciated?

1 Answers1

0

The dependency that you have added and the one used might be different at runtime, have a double check of all the dependencies that you are using. It clearly says that the method is not available and if you knew it exists then definitely it might be removed (in newer versions) or that method does not exists (in older versions it didn't have that method).

Raghuveer
  • 2,859
  • 7
  • 34
  • 66
  • That method is implemented by me, it's not the dependency related method. The error is thrown only when I run a test using Spek as mention above. `./gradlew test` works fine. – Baidyanath Prasad Aug 17 '18 at 09:14
  • Sorry, have already gone through the above tutorial and also following the very similar. But there is a Spek plugin available in IDEA which enables to run the particular `describe` in the Spek which fails - that's the actual issue here!! – Baidyanath Prasad Aug 17 '18 at 09:35
  • So if its an issue with the plugin then just run testcases from command prompt. – Raghuveer Aug 17 '18 at 10:21
  • Yeah, that can be but in that case, debugging will be hard with just logging. This is the reason why we use the `Spek plugin`, it makes life simple while you're debugging. – Baidyanath Prasad Aug 17 '18 at 10:30
  • maven can help there, it has a debug port as well. – Raghuveer Aug 17 '18 at 11:08
  • Ohh, currently using the Gradle build tool, just for one thing, changing the whole project's dependency is not a good idea. – Baidyanath Prasad Aug 17 '18 at 11:23
  • You need to produce a minimal example that can help in debugging the problem. The build file is a great place to start. – raniejade Aug 17 '18 at 23:09
  • @raniejade Yes, tried with the minimal example like one contract containing `greeting()` method and a class that implements the contract within the module. Getting the same error. What do you mean by `The build file is a great place to start`? – Baidyanath Prasad Aug 21 '18 at 07:15
  • @BaidyanathPrasad please share your build script. – raniejade Aug 22 '18 at 00:40
  • @raniejade I got the issue. The issue is with Gradle cache which stores the previous result for the same input. I'm able to clear the cache in command line but still, I'm not able to clear cache in the UI i.e JUnit plugin in the IDEA. If you know how clear the cache in UI, let me know? – Baidyanath Prasad Aug 23 '18 at 06:01