JUnit 4 Android Integration Rules

A set of handy junit rules.

License

License

Categories

Categories

JUnit Unit Testing
GroupId

GroupId

com.vanniktech
ArtifactId

ArtifactId

junit4-android-integration-rules
Last Version

Last Version

0.3.0
Release Date

Release Date

Type

Type

aar
Description

Description

JUnit 4 Android Integration Rules
A set of handy junit rules.
Project URL

Project URL

https://github.com/vanniktech/junit-rules
Source Code Management

Source Code Management

https://github.com/vanniktech/junit-rules

Download junit4-android-integration-rules

How to add to project

<!-- https://jarcasting.com/artifacts/com.vanniktech/junit4-android-integration-rules/ -->
<dependency>
    <groupId>com.vanniktech</groupId>
    <artifactId>junit4-android-integration-rules</artifactId>
    <version>0.3.0</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/com.vanniktech/junit4-android-integration-rules/
implementation 'com.vanniktech:junit4-android-integration-rules:0.3.0'
// https://jarcasting.com/artifacts/com.vanniktech/junit4-android-integration-rules/
implementation ("com.vanniktech:junit4-android-integration-rules:0.3.0")
'com.vanniktech:junit4-android-integration-rules:aar:0.3.0'
<dependency org="com.vanniktech" name="junit4-android-integration-rules" rev="0.3.0">
  <artifact name="junit4-android-integration-rules" type="aar" />
</dependency>
@Grapes(
@Grab(group='com.vanniktech', module='junit4-android-integration-rules', version='0.3.0')
)
libraryDependencies += "com.vanniktech" % "junit4-android-integration-rules" % "0.3.0"
[com.vanniktech/junit4-android-integration-rules "0.3.0"]

Dependencies

compile (3)

Group / Artifact Type Version
androidx.test » runner jar 1.1.1
junit : junit jar 4.13-beta-1
org.jetbrains.kotlin : kotlin-stdlib jar 1.3.11

Project Modules

There are no modules declared in this project.

junit-rules

A set of handy junit rules.

JUnit 4

testImplementation 'com.vanniktech:junit4-rules:0.3.0'
testImplementation 'com.vanniktech:junit4-rules:0.4.0-SNAPSHOT'

DefaultLocaleRule

JUnit rule for taking control over the Locale.

/** Creates the rule and will safely restore the default locale for each test. */
@Rule public final DefaultLocaleRule defaultLocaleRule = new DefaultLocaleRule();
/** Creates the rule and will set the preferred locale for each test. */
@Rule public final DefaultLocaleRule defaultLocaleRule = new DefaultLocaleRule(US);

DefaultTimeZoneRule

JUnit rule for taking control over the Timezone.

/** Creates the rule and will safely restore the default timezone for each test. */
@Rule public final DefaultTimeZoneRule defaultTimeZoneRule = new DefaultTimeZoneRule();
/** Creates the rule and will set the preferred timezone for each test. */
@Rule public final DefaultTimeZoneRule defaultTimeZoneRule = new DefaultTimeZoneRule(TimeZone.getTimeZone("GMT-08:00"));

For more information have a look at the tests.

JUnit 4 Android Integration

androidTestImplementation 'com.vanniktech:junit4-android-integration-rules:0.2.0'
androidTestImplementation 'com.vanniktech:junit4-android-integration-rules:0.3.0-SNAPSHOT'

DemoModeRule

JUnit rule for specifying some of the UI demo commands and customize some part of the Status as well as the Navigation bar. Thanks to Hugo Visser for this inspiration and sharing the initial piece.

/** Creates the rule in default mode and shows you a clean status bar with half mobile data reception, 100% battery and an 11am clock. */
@Rule public final DemoModeRule demoModeRule = new DemoModeRule();
/** Creates the rule and lets you specify all of your preferred certain options. Have a look at the documentation for more information. */
@Rule public final DemoModeRule demoModeRule = new DemoModeRule(
  notifications().visible(false),
  network().wifi(true).mobileDataType(MOBILE_DATA_TYPE_E),
  battery().level(11).plugged(false).powersave(true),
  status().bluetooth(BLUETOOTH_MODE_CONNECTED).speakerphone(true),
  clock().hhmm("1800")
)

For more information have a look at the tests.

License

Copyright (C) 2017 Vanniktech - Niklas Baudy

Licensed under the Apache License, Version 2.0

Versions

Version
0.3.0
0.2.0