mockitoid

Mockito mocks and asserts for android

License

License

MIT
Categories

Categories

Mockito Unit Testing
GroupId

GroupId

de.jodamob.android
ArtifactId

ArtifactId

mockitoid
Last Version

Last Version

0.7
Release Date

Release Date

Type

Type

jar
Description

Description

mockitoid
Mockito mocks and asserts for android
Project URL

Project URL

https://github.com/dpreussler/mockitoid
Source Code Management

Source Code Management

https://github.com/dpreussler/mockitoid

Download mockitoid

How to add to project

<!-- https://jarcasting.com/artifacts/de.jodamob.android/mockitoid/ -->
<dependency>
    <groupId>de.jodamob.android</groupId>
    <artifactId>mockitoid</artifactId>
    <version>0.7</version>
</dependency>
// https://jarcasting.com/artifacts/de.jodamob.android/mockitoid/
implementation 'de.jodamob.android:mockitoid:0.7'
// https://jarcasting.com/artifacts/de.jodamob.android/mockitoid/
implementation ("de.jodamob.android:mockitoid:0.7")
'de.jodamob.android:mockitoid:jar:0.7'
<dependency org="de.jodamob.android" name="mockitoid" rev="0.7">
  <artifact name="mockitoid" type="jar" />
</dependency>
@Grapes(
@Grab(group='de.jodamob.android', module='mockitoid', version='0.7')
)
libraryDependencies += "de.jodamob.android" % "mockitoid" % "0.7"
[de.jodamob.android/mockitoid "0.7"]

Dependencies

compile (3)

Group / Artifact Type Version
org.mockito : mockito-all jar 1.9.5
com.android.support » recyclerview-v7 jar 23.2.1
com.android.support » cardview-v7 jar 23.2.1

Project Modules

There are no modules declared in this project.

Build Status Maven Central

mockitoid

Android specific assertions and mocks for mockito for cleaner test code

Gradle

testCompile 'de.jodamob.android:mockitoid:0.7'
 

Asserts

write anyActivity() instead of any(Activity.class) in mockito verification.

example:

verify(myInteractor).showWizard(anyActivity());

Same with:

anyFragment()
anyFragmentManager()
anyIntent()
anyContext()
anyView()
anyButton()
...

more to be come

Mocks

write mockActivity() instead of mock(Activity.class) Same with:

mockFragment()
mockResources()
mockContext()
mockIntent()
mockBundle()
...

some mocks can have small behavior: mockTextView("test") given a Textview that will return an Editable that has string "test"

mockFragmentManager(FragmentTransaction) will return this fragmenttransaction for every transaction started

mockRecyclerView() will return a recyclerview that will remember adapter and laoutManager between set and get

mockMenuItem(id) where id will be the itemId that will return a MenuItem mock for ..

Licensed under MIT license (c) 2015-2016 Danny Preussler

Versions

Version
0.7
0.6
0.5
0.2