Skip to content

Instantly share code, notes, and snippets.

View quentin7b's full-sized avatar
🌴
Aloha

Quentin Klein quentin7b

🌴
Aloha
View GitHub Profile
@quentin7b
quentin7b / Test_TestMyObject.java
Last active August 29, 2015 14:25
[Robolectric / Jacoco] Test Example
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ErrorCollector;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricGradleTestRunner;
import org.robolectric.annotation.Config;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.not;
@quentin7b
quentin7b / drawer_open.java
Last active August 29, 2015 14:21
Robotium 5.3.1 (App compat API 21+) / Open navigation drawer
/**
* As we use app compat it seems Solo#setNavigationDrawer is not doing well (drawer does not open, but the button is clicked)
* Same result for clickOnView(getView(android.R.id.home))
*
* This code opens the navigation drawer on the main thread
* Be aware : you need to provide your DrawerLayout id (you can do it in params)
*/
public void openCompatNavigationDrawer() {
getInstrumentation().runOnMainSync(new Runnable() {
@Override
@quentin7b
quentin7b / click_on_button.java
Last active May 21, 2021 11:16
Espresso recycler view item button click
onView(withId(R.id.recycler_view_id))
.perform(
RecyclerViewActions.actionOnItemAtPosition(
itemPosition,
new ViewAction() {
@Override
public Matcher<View> getConstraints() {
return null;
}
@quentin7b
quentin7b / android-checkstyle.xml
Created October 9, 2014 09:07
Custom Android Studio checkstyle.xml for Android
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<!--
Checkstyle-Configuration: Android Checks (Android Studio)
Description:
Slightly modified version of Sun Checks that better matches the default code formatter setting of Eclipse.
-->
<module name="Checker">
<property name="severity" value="warning"/>