views:

169

answers:

1

I have a project in NetBeans with JUnit tests. I made a change to a method return type in a dependent project, and the app runs fine. But when I run the JUnit test from inside NetBeans I get a NoSuchMethodError. I made sure to clean and build.

A: 

The solution was to make a change (any change) to the class which was making the call to the changed method. I then saved the class, then undid the change and saved the class. Then running the JUnit test inside NetBeans worked. It seems like a bug with NetBeans caching. I've had strange issues like this before and I've had to close NetBeans, delete the NetBeans cache folder, and restart NetBeans. But it seems like making a change to that class (and then undoing it) was enough to fix the NetBeans cache.

Liron Yahdav