I am creating unit tests for our charting package (per our development process). We use Roboelectric to speed up test runs. I have been able to successfully create tests for LineSeries charts, but once I tried to create a test for our CandlestickSeries chart, I started getting this exception.
java.lang.NoClassDefFoundError: com/shinobicontrols/charts/r (wrong name: com/shinobicontrols/charts/R) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637) at java.lang.ClassLoader.defineClass(ClassLoader.java:621) at java.lang.ClassLoader.defineClass(ClassLoader.java:471) at org.robolectric.bytecode.AsmInstrumentingClassLoader.findClass(AsmInstrumentingClassLoader.java:153) at org.robolectric.bytecode.AsmInstrumentingClassLoader.loadClass(AsmInstrumentingClassLoader.java:95) at com.shinobicontrols.charts.CandlestickSeries.<init>(SourceFile:25)
I believe this issue is because CandlestickSeries uses an obfuscated class called ‘r’, which is conflicting with the standard resource class ‘R’. I am developing on a Mac, which could be causing some of the issue as it is not case sensitive. I believe if you rebuilt the jar with obfuscation, but disallowing ‘r’ as a valid name, then my tests would work.