Questions tagged [dexmaker]

Programmatic code generation for Android.

dexmaker is a Java-language API for doing compile time or runtime code generation targeting the Dalvik VM. Unlike cglib or ASM, this library creates Dalvik .dex files instead of Java .class files.

19 questions
37
votes
7 answers

Mockito + Dexmaker on Android

I am trying to use Mockito in my Android project. I have found very nice tutorial that deals with it: http://www.paulbutcher.com/2012/05/mockito-on-android-step-by-step/ Basically it uses new version of Mockito + Dexmaker and everything works as…
stevo.mit
  • 4,681
  • 4
  • 37
  • 47
19
votes
5 answers

VerifyError using Mockito 1.9.5 and DexMaker-Mockito-1.0

Like many others I was excited to hear that Mockito now works with Android and followed this tutorial to see it with my own eyes. Everything seemed fan-flapping-tastic and I got underway incorporating the mocking solution into my Android Test…
BrantApps
  • 6,362
  • 2
  • 27
  • 60
13
votes
1 answer

Mockito mocks run actual Android code in Lollipop or greater

So I have a Database class that has a dependency that extends SQLOpenHelper and I am testing using Android instrumented tests and Mockito to mock dependencies. We are noticing that Mockito isn't actually mocking the implementations when doing…
Stampede10343
  • 844
  • 1
  • 6
  • 21
8
votes
3 answers

How to get Powermock to work with Dexmaker

I am trying to incorporate Powermock as a dependency for my Android tests using the following build.gradle configuration: dependencies{ compile 'com.android.support:appcompat-v7:21.0.+' androidTestCompile('org.mockito:mockito-core:1.9.5') …
Some Noob Student
  • 14,186
  • 13
  • 65
  • 103
7
votes
2 answers

java.lang.AbstractMethodError when spy the LinkedList in Android

I want to spy the Linkedlist in android. List list = new LinkedList(); List spyData = Mockito.spy(list); spyData.add("xxxx"); However, the exception occured. java.lang.AbstractMethodError: abstract method "boolean…
alec.tu
  • 1,647
  • 2
  • 20
  • 41
6
votes
1 answer

How to use Mockito with dexmaker for Android Testing?

I am trying to get Mockito (1.9.5 rc1) working in my Android tests (using Robotium). For making it run on the DVM I put dexmaker.jar and the dexmaker-mockito.jar (v 0.9) in the classpath of the test-project. When run following test as an Android…
Benjamin
  • 1,726
  • 1
  • 14
  • 35
5
votes
1 answer

Mockito + Dexmaker test crashes when run on Android < 4.4

I have some android-tests that crash hard when run on android versions under 4.4 / Kitkat. These are the libraries I have in my build.gradle androidTestCompile 'org.mockito:mockito-core:1.9.5' androidTestCompile…
msung
  • 3,562
  • 3
  • 19
  • 30
4
votes
2 answers

java.lang.NoClassDefFoundError: org.mockito.Mockito

I'm trying to run unit test on Android Library project and using mockito 1.9.5 with dexmaker 1.0 & dexmaker -mockito-1.0 jar files. I am using Android Studio 0.2.6 and whenever I run a test case I end up getting java.lang.NoClassDefFoundError:…
Prasanna
  • 57
  • 1
  • 4
3
votes
1 answer

Mocking/Stubbing final classes in Android

I'm trying to create automated tests for Android which would emulate Bluetooth communication. Mockito and DexMaker are working ok but not in this case since good part of the Bluetooth API is consisted of final classes which Mockito can't mock nor…
vbokan
  • 133
  • 6
2
votes
1 answer

UnsupportedOperationException with Mockito and Dexmaker

recently I've been struggling with Mockito. But after valiant efforts, I made it compile without errors except this one in a particular case : When I'm mocking a package-private class with Mockito, with a test in the same package, I get the…
Racater
  • 185
  • 3
  • 11
2
votes
2 answers

Does Mockito require Dexmaker when mocking Android applications?

The documentation of the Mockito and Dexmaker projects does not seem to clearly state the relationship between the two, they only make mention of each other. If Dexmaker is required, which versions of Mockito and Dexmaker are compatible?, and is…
Ryan
  • 1,331
  • 2
  • 12
  • 18
1
vote
2 answers

Compiling Java code under Android in runtime

I have a class name String and a String which containing the class code. For example, "Example" is the name of the class, and public class Example { public void example () {System.out.println ("Hello world!"); } } The class code. I looked at…
1
vote
1 answer

NoClassDefFoundError ObjenesisStd on Android API 19

I'm getting the following crashing during an instrumentation test ONLY on emulators running API v19. If I run on newer versions everything works fine. 03-01 20:26:18.781 2878-2878/? E/MonitoringInstrumentation: Exception encountered by:…
Christopher Perry
  • 38,891
  • 43
  • 145
  • 187
1
vote
1 answer

Are DexMaker Mockito mocks stubs, spies, partials, or what?

When I mock an object with Mockito.mock(), I expect the object to have stubbed out methods that return null, 0, false, et al, without having any of the code of the real object I'm mocking. I thought this was the default behavior in Java, but Android…
Tremelune
  • 352
  • 2
  • 11
1
vote
1 answer

Code injection for Android

I want to write an ORM for Android as my final project. My first idea is to inject code for each get and set. Unfortunately I found a lot of posts saying there is no way to inject code in Android. On the other hand I found "Dexmaker" to generate…
orwe
  • 233
  • 1
  • 3
  • 10
1
2