[
  {
    "path": ".gitignore",
    "content": "# Built application files\n*.apk\n*.ap_\n\n# Files for the Dalvik VM\n*.dex\n\n# Java class files\n*.class\n\n# Generated files\nbin/\ngen/\n\n# Gradle files\n.gradle/\nbuild/\n\n# Local configuration file (sdk path, etc)\nlocal.properties\n\n# Proguard folder generated by Eclipse\nproguard/\n\n# Log Files\n*.log\n\n# Android Studio Navigation editor temp files\n.navigation/\n\n# Android Studio captures folder\ncaptures/\n\n.gradle\n.idea\n*.iml\n**/build/*"
  },
  {
    "path": "LICENSE",
    "content": "                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"{}\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright {yyyy} {name of copyright owner}\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "README.md",
    "content": "# Android Unit Test\n\nSave time & clear your unit tests on Android ! \n\nUse annotations to inject Context, Activities, Fragments and Views into your tests\n\n\n<a href=\"https://goo.gl/WXW8Dc\">\n  <img alt=\"Android app on Google Play\" src=\"https://developer.android.com/images/brand/en_app_rgb_wo_45.png\" />\n</a>\n\n\n# Usage\n\n```java\n@RunWith(CustomTestRunner.class)\npublic class MainActivityTest {\n    @Rule public AndroidUnitTest androidUnitTest = AndroidUnitTest.rule();\n\n    @RContect Context context; //inject the app context\n    @RActivity MainActivity activity; //generates the tested activity\n    @Mock User user; //mock an user\n\n    @Test\n    public void testDisplayUser() throws Exception {\n        // Given\n        given(user.getName()).willReturn(\"florent\");\n        \n        // When\n        activity.display(user);\n        \n        // Then\n        assertThat(activity.textView.getText()).isEqualTo(\"florent\");\n    }\n}\n```\n\n## TestRunner\n\nSimplify Robolectric Integration\n\n```java\npublic class CustomTestRunner extends AndroidUnitTestRunner {\n    public CustomTestRunner(Class<?> testClass) throws InitializationError {\n        super(testClass, BuildConfig.FLAVOR, BuildConfig.BUILD_TYPE, BuildConfig.APPLICATION_ID, TestMyApplication.class);\n    }\n}\n```\n\n## Activity\n\nSet initial activity state (by default activity is created())\n\n```java\n@RunWith(CustomTestRunner.class)\npublic class MyTest {\n    @Rule public AndroidUnitTest androidUnitTest = AndroidUnitTest.rule();\n\n    @RActivity(state = CREATED / STARTED / RESUMED / PAUSED / STOPPED / DESTROYED)\n    MainActivity activity;\n    \n    @Test\n    public void testMyFunction(){\n         androidUnitTest.activity().resume();\n    }\n\n}\n```\n\nNote that the injected activity is a spy !\n\n```java\nverify(activity, times(2)).someMethod(anyInt());\n```\n\n## Context\n\nRetrieve Context easily\n\n```java\n@RunWith(CustomTestRunner.class)\npublic class MyTest {\n    @Rule public AndroidUnitTest androidUnitTest = AndroidUnitTest.rule();\n\n    @RContext Context context;\n}\n```\n\nNote that the injected context is a spy !\n\n```java\nverify(context, times(2)).someMethod(anyInt());\n```\n\n## View\n\n```java\n@RunWith(CustomTestRunner.class)\npublic class MyTest {\n    @Rule public AndroidUnitTest androidUnitTest = AndroidUnitTest.rule();\n\n    @RView CustomView customView;\n    \n    @Test\n    public void testDisplayUser() throws Exception {\n        // Given\n        given(user.getName()).willReturn(\"florent\");\n        \n        // When\n        mainView.display(user);\n        \n        // Then\n        verify(customView).displayText(\"florent\");\n    }\n}\n```\n\nNote that the injected view is a spy !\n\n## Fragment\n\n```java\n@RunWith(CustomTestRunner.class)\npublic class MyTest {\n    @Rule public AndroidUnitTest androidUnitTest = AndroidUnitTest.rule();\n\n    @RFragment MyFragment myFragment;\n    @Mock User user;\n    \n    @Test\n    public void testDisplayUser() throws Exception {\n        // Given\n        given(user.getName()).willReturn(\"florent\");\n        \n        // When\n        myFragment.display(user);\n        \n        // Then\n        verify(myFragment).displayText(\"florent\");\n    }\n}\n```\n\n```java\n@RunWith(CustomTestRunner.class)\npublic class MyTest {\n    @Rule public AndroidUnitTest androidUnitTest = AndroidUnitTest.rule();\n\n    @RFragment(\n        attached = true / false,\n        tag = \"fragmentTag\"\n    )\n    MyFragment myFragment;\n        \n    @Test\n    public void testMyFunction() throws Exception {\n        androidUnitTest.fragment().addToActivity(myFragment)\n    }\n}\n```\n\nNote that the injected fragment is a spy !\n\n# Download\n\n<a href='https://ko-fi.com/A160LCC' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://az743702.vo.msecnd.net/cdn/kofi1.png?v=0' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>\n\n [ ![Download](https://api.bintray.com/packages/florent37/maven/AndroidUnitTest/images/download.svg) ](https://bintray.com/florent37/maven/AndroidUnitTest/_latestVersion)\n\n```java\ntestCompile 'com.github.florent37:androidunittest:(last version)'\n\ntestCompile 'junit:junit:4.12'\ntestCompile 'org.mockito:mockito-core:1.10.19'\ntestCompile 'org.robolectric:robolectric:3.0'\n```\n\n# Credits\n\nAuthor: Florent Champigny \n\n\n<a href=\"https://goo.gl/WXW8Dc\">\n  <img alt=\"Android app on Google Play\" src=\"https://developer.android.com/images/brand/en_app_rgb_wo_45.png\" />\n</a>\n\n<a href=\"https://plus.google.com/+florentchampigny\">\n  <img alt=\"Follow me on Google+\"\n       src=\"https://raw.githubusercontent.com/florent37/DaVinci/master/mobile/src/main/res/drawable-hdpi/gplus.png\" />\n</a>\n<a href=\"https://twitter.com/florent_champ\">\n  <img alt=\"Follow me on Twitter\"\n       src=\"https://raw.githubusercontent.com/florent37/DaVinci/master/mobile/src/main/res/drawable-hdpi/twitter.png\" />\n</a>\n<a href=\"https://fr.linkedin.com/in/florentchampigny\">\n  <img alt=\"Follow me on LinkedIn\"\n       src=\"https://raw.githubusercontent.com/florent37/DaVinci/master/mobile/src/main/res/drawable-hdpi/linkedin.png\" />\n</a>\n\nLicense\n--------\n\n    Copyright 2016 florent37, Inc.\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n"
  },
  {
    "path": "androidunittest/.gitignore",
    "content": "/build\n"
  },
  {
    "path": "androidunittest/build.gradle",
    "content": "apply plugin: 'com.android.library'\n\nandroid {\n    compileSdkVersion project.sdk\n    buildToolsVersion project.buildTools\n\n    defaultConfig {\n        minSdkVersion project.minSdk\n        targetSdkVersion project.sdk\n        versionCode 1\n        versionName \"1.0\"\n    }\n}\n\ndependencies {\n    compile(\n            'junit:junit:4.12',\n            'org.mockito:mockito-core:1.10.19',\n            'org.robolectric:robolectric:3.0',\n            'com.android.support:support-annotations:'+project.supportVersion,\n            'com.android.support:appcompat-v7:'+project.supportVersion\n    )\n    testCompile 'com.google.truth:truth:0.28'\n}\n\n\next {\n    bintrayRepo = 'maven'\n    bintrayName = 'AndroidUnitTest'\n    orgName = 'florent37'\n\n    publishedGroupId = 'com.github.florent37'\n    libraryName = 'AndroidUnitTest'\n    artifact = 'androidunittest'\n\n    libraryDescription = 'AndroidUnitTest'\n\n    siteUrl = 'https://github.com/florent37/AndroidUnitTest'\n    gitUrl = 'https://github.com/florent37/AndroidUnitTest.git'\n\n    libraryVersion = rootProject.ext.libraryVersion\n\n    developerId = 'florent37'\n    developerName = 'Florent Champigny'\n    developerEmail = 'champigny.florent@gmail.com'\n\n    licenseName = 'The Apache Software License, Version 2.0'\n    licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'\n    allLicenses = [\"Apache-2.0\"]\n}\n\nif (project.rootProject.file('local.properties').exists()) {\n    apply from: rootProject.file('gradle/install-v1.gradle')\n    apply from: rootProject.file('gradle/bintray-android-v1.gradle')\n}"
  },
  {
    "path": "androidunittest/proguard-rules.pro",
    "content": "# Add project specific ProGuard rules here.\n# By default, the flags in this file are appended to flags specified\n# in /Users/florentchampigny/Android/sdk/tools/proguard/proguard-android.txt\n# You can edit the include path and order by changing the proguardFiles\n# directive in build.gradle.\n#\n# For more details, see\n#   http://developer.android.com/guide/developing/tools/proguard.html\n\n# Add any project specific keep options here:\n\n# If your project uses WebView with JS, uncomment the following\n# and specify the fully qualified class name to the JavaScript interface\n# class:\n#-keepclassmembers class fqcn.of.javascript.interface.for.webview {\n#   public *;\n#}\n"
  },
  {
    "path": "androidunittest/src/androidTest/java/com/github/florent37/androidunittest/ApplicationTest.java",
    "content": "package com.github.florent37.androidunittest;\n\nimport android.app.Application;\nimport android.test.ApplicationTestCase;\n\n/**\n * <a href=\"http://d.android.com/tools/testing/testing_android.html\">Testing Fundamentals</a>\n */\npublic class ApplicationTest extends ApplicationTestCase<Application> {\n    public ApplicationTest() {\n        super(Application.class);\n    }\n}"
  },
  {
    "path": "androidunittest/src/main/AndroidManifest.xml",
    "content": "<manifest package=\"com.github.florent37.androidunittest\"\n          xmlns:android=\"http://schemas.android.com/apk/res/android\">\n\n    <application\n        android:allowBackup=\"true\"\n        android:label=\"@string/app_name\"\n        android:supportsRtl=\"true\"\n        >\n\n    </application>\n\n</manifest>\n"
  },
  {
    "path": "androidunittest/src/main/java/com/github/florent37/androidunittest/AndroidUnitTest.java",
    "content": "package com.github.florent37.androidunittest;\n\nimport android.support.annotation.Nullable;\n\nimport com.github.florent37.androidunittest.controllers.ControllerActivity;\nimport com.github.florent37.androidunittest.controllers.ControllerFragment;\n\nimport org.junit.rules.MethodRule;\nimport org.junit.runners.model.FrameworkMethod;\nimport org.junit.runners.model.Statement;\nimport org.mockito.Mockito;\nimport org.mockito.MockitoAnnotations;\nimport org.robolectric.util.ActivityController;\n\n/**\n * Created by florentchampigny on 07/05/2016.\n */\npublic class AndroidUnitTest implements MethodRule {\n\n    ControllerActivity controllerActivity;\n    ControllerFragment controllerFragment;\n    @Nullable ActivityController activityController;\n    private AndroidUnitTestAnnotations androidUnitTestAnnotations;\n\n    protected AndroidUnitTest() {\n        androidUnitTestAnnotations = new AndroidUnitTestAnnotations(AndroidUnitTest.this);\n        controllerActivity = new ControllerActivity(this);\n        controllerFragment = new ControllerFragment(this);\n    }\n\n    public static AndroidUnitTest rule() {\n        return new AndroidUnitTest();\n    }\n\n    @Override\n    public Statement apply(final Statement base, FrameworkMethod method, final Object target) {\n        return new Statement() {\n            @Override\n            public void evaluate() throws Throwable {\n                MockitoAnnotations.initMocks(target);\n                androidUnitTestAnnotations.init(target);\n                base.evaluate();\n                Mockito.validateMockitoUsage();\n            }\n        };\n    }\n\n    @Nullable\n    public ActivityController getActivityController() {\n        return activityController;\n    }\n\n    public void setActivityController(@Nullable ActivityController activityController) {\n        this.activityController = activityController;\n    }\n\n    public AndroidUnitTestAnnotations getAndroidUnitTestAnnotations() {\n        return androidUnitTestAnnotations;\n    }\n\n    public ControllerActivity activity() {\n        return controllerActivity;\n    }\n\n    public ControllerFragment fragment() {\n        return controllerFragment;\n    }\n\n}\n"
  },
  {
    "path": "androidunittest/src/main/java/com/github/florent37/androidunittest/AndroidUnitTestAnnotations.java",
    "content": "package com.github.florent37.androidunittest;\n\nimport android.content.Context;\nimport android.support.annotation.NonNull;\nimport android.support.v4.app.Fragment;\n\nimport com.github.florent37.androidunittest.managers.AbstractAnnotationManager;\nimport com.github.florent37.androidunittest.managers.AnnotationActivityManager;\nimport com.github.florent37.androidunittest.managers.AnnotationContextManager;\nimport com.github.florent37.androidunittest.managers.AnnotationFragmentManager;\nimport com.github.florent37.androidunittest.managers.AnnotationViewManager;\n\nimport org.robolectric.RuntimeEnvironment;\n\nimport java.lang.reflect.Field;\n\n/**\n * Created by florentchampigny on 07/05/2016.\n */\npublic class AndroidUnitTestAnnotations {\n    final Context context;\n\n    AndroidUnitTest androidUnitTest;\n    Object target;\n\n    AbstractAnnotationManager managers[];\n    AnnotationActivityManager activityManager;\n    AnnotationFragmentManager fragmentManager;\n\n\n    private AndroidUnitTestAnnotations() {\n        context = RuntimeEnvironment.application;\n    }\n\n    public AndroidUnitTestAnnotations(AndroidUnitTest androidUnitTest) {\n        this();\n\n        this.androidUnitTest = androidUnitTest;\n    }\n\n\n    public AndroidUnitTestAnnotations init(Object target) {\n        //find @Activity\n        //find @Fragment\n        //find @RContext -> RuntimeEnvironment.application;\n        this.target = target;\n\n        instantiate();\n        scan();\n        execute();\n        return this;\n    }\n\n\n    public void updateActivity() {\n        activityManager.updateActivity(target);\n    }\n\n    public void addToActivity(@NonNull Fragment fragment) {\n        fragmentManager.addToActivity(target, fragment);\n    }\n\n    public void removeFromActivity(@NonNull Fragment fragment) {\n        fragmentManager.removeFromActivity(fragment);\n    }\n\n\n    /**\n     * Instantiate the list of abstract annotation managers\n     */\n    private void instantiate() {\n        managers = new AbstractAnnotationManager[]{\n                new AnnotationContextManager(androidUnitTest),\n                new AnnotationActivityManager(androidUnitTest),\n                new AnnotationFragmentManager(androidUnitTest),\n                new AnnotationViewManager(androidUnitTest)\n        };\n\n        activityManager = (AnnotationActivityManager) managers[1];\n        fragmentManager = (AnnotationFragmentManager) managers[2];\n    }\n\n    /**\n     * Scan the target to populate the managers\n     */\n    private void scan() {\n        for (Field field : target.getClass().getDeclaredFields()) {\n            for (AbstractAnnotationManager manager : managers)\n                if (manager.canManage(field))\n                    manager.scanned(field);\n        }\n    }\n\n    /**\n     * Execute the different managers\n     *\n     * given their positions, it represents their dependencies\n     */\n    private void execute() {\n        for (AbstractAnnotationManager manager : managers)\n            manager.execute(target, context);\n    }\n}"
  },
  {
    "path": "androidunittest/src/main/java/com/github/florent37/androidunittest/AndroidUnitTestRunner.java",
    "content": "package com.github.florent37.androidunittest;\n\nimport android.app.Application;\nimport android.os.Build;\nimport android.support.annotation.NonNull;\nimport android.support.annotation.Nullable;\n\nimport org.junit.runners.model.InitializationError;\nimport org.robolectric.RobolectricTestRunner;\nimport org.robolectric.annotation.Config;\nimport org.robolectric.internal.bytecode.InstrumentationConfiguration;\nimport org.robolectric.internal.bytecode.ShadowMap;\nimport org.robolectric.manifest.AndroidManifest;\n\nimport java.io.File;\nimport java.util.Properties;\n\npublic class AndroidUnitTestRunner extends RobolectricTestRunner {\n\n    public static final String PATH_ASSET = \"../../../assets/\";\n    public static final String PATH_RESOURCE = \"../../../res/merged/\";\n    public static final String PATH_MANIFEST = \"build/intermediates/manifests/full/%s/AndroidManifest.xml\";\n\n    public static final String CONFIG_APPLICATION = \"application\";\n    public static final String CONFIG_MANIFEST = \"manifest\";\n    public static final String CONFIG_ASSET_DIR = \"assetDir\";\n    public static final String CONFIG_RESOURCE_DIR = \"resourceDir\";\n    public static final String CONFIG_PACKAGE_NAME = \"packageName\";\n    public static final String CONFIG_SDK = \"sdk\";\n\n    public static final String PATH_PREFIX = \"app/\";\n    final String packageName;\n    final String flavor;\n    final String buildType;\n    final Class<? extends Application> applicationClass;\n\n    public AndroidUnitTestRunner(Class<?> testClass, @NonNull String flavor, @NonNull String buildType, String packageName, @Nullable Class<? extends Application> applicationClass) throws InitializationError {\n        super(testClass);\n        this.packageName = packageName;\n        this.applicationClass = applicationClass;\n        this.flavor = flavor;\n        this.buildType = buildType;\n    }\n\n    public String getPathManifest() {\n        String path = buildType;\n        if (flavor != null && !flavor.isEmpty()) {\n            path = String.format(\"%s/%s\", flavor, path);\n        }\n        return String.format(PATH_MANIFEST, path);\n    }\n\n    public String getPathAssets() {\n        String prePath = \"\";\n        String postPath = buildType;\n        if (flavor != null && !flavor.isEmpty()) {\n            prePath = \"../\";\n            postPath = String.format(\"%s/%s\", flavor, postPath);\n        }\n        return prePath + PATH_ASSET + postPath;\n    }\n\n    public String getPathResources() {\n        String prePath = \"\";\n        String postPath = buildType;\n        if (flavor != null && !flavor.isEmpty()) {\n            prePath = \"../\";\n            postPath = String.format(\"%s/%s\", flavor, postPath);\n        }\n        return prePath + PATH_RESOURCE + postPath;\n    }\n\n    @Override\n    public InstrumentationConfiguration createClassLoaderConfig() {\n        InstrumentationConfiguration.Builder builder = InstrumentationConfiguration.newBuilder();\n        return builder.build();\n    }\n\n    @Override\n    protected AndroidManifest getAppManifest(Config config) {\n        String path = getPathManifest();\n\n        // android studio has a different execution root for tests than pure gradle\n        // so we avoid here manual effort to get them running inside android studio\n        if (!new File(path).exists()) {\n            path = PATH_PREFIX + path;\n        }\n\n        config = overwriteConfig(config, CONFIG_MANIFEST, path);\n        config = overwriteConfig(config, CONFIG_ASSET_DIR, getPathAssets());\n        config = overwriteConfig(config, CONFIG_RESOURCE_DIR, getPathResources());\n        if (packageName != null) {\n            config = overwriteConfig(config, CONFIG_PACKAGE_NAME, packageName);\n        }\n        if (applicationClass != null) {\n            config = overwriteConfig(config, CONFIG_APPLICATION, applicationClass.getCanonicalName());\n        }\n        return super.getAppManifest(config);\n    }\n\n    @Override\n    protected int pickSdkVersion(Config config, AndroidManifest manifest) {\n        config = overwriteConfig(config, CONFIG_SDK, String.valueOf(Build.VERSION_CODES.JELLY_BEAN));\n        return super.pickSdkVersion(config, manifest);\n    }\n\n    @Override\n    protected ShadowMap createShadowMap() {\n        return super.createShadowMap()\n            .newBuilder()\n            .build();\n    }\n\n    protected Config.Implementation overwriteConfig(Config config, String key, String value) {\n        Properties properties = new Properties();\n        properties.setProperty(key, value);\n        return new Config.Implementation(config, Config.Implementation.fromProperties(properties));\n    }\n}\n"
  },
  {
    "path": "androidunittest/src/main/java/com/github/florent37/androidunittest/annotations/RActivity.java",
    "content": "package com.github.florent37.androidunittest.annotations;\n\nimport com.github.florent37.androidunittest.states.ActivityState;\n\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\n\n/**\n * Created by florentchampigny on 07/05/2016.\n */\n@Retention(RetentionPolicy.RUNTIME)\npublic @interface RActivity {\n    ActivityState state() default ActivityState.CREATED;\n}\n"
  },
  {
    "path": "androidunittest/src/main/java/com/github/florent37/androidunittest/annotations/RContext.java",
    "content": "package com.github.florent37.androidunittest.annotations;\n\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\n\n/**\n * Created by florentchampigny on 07/05/2016.\n */\n@Retention(RetentionPolicy.RUNTIME)\npublic @interface RContext {\n}\n"
  },
  {
    "path": "androidunittest/src/main/java/com/github/florent37/androidunittest/annotations/RFragment.java",
    "content": "package com.github.florent37.androidunittest.annotations;\n\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\n\n/**\n * Created by florentchampigny on 07/05/2016.\n */\n@Retention(RetentionPolicy.RUNTIME)\npublic @interface RFragment {\n    boolean attached() default true;\n    String tag() default \"\";\n}\n"
  },
  {
    "path": "androidunittest/src/main/java/com/github/florent37/androidunittest/annotations/RView.java",
    "content": "package com.github.florent37.androidunittest.annotations;\n\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\n\n/**\n * Created by florentchampigny on 07/05/2016.\n */\n@Retention(RetentionPolicy.RUNTIME)\npublic @interface RView {\n    boolean attached() default true;\n}\n"
  },
  {
    "path": "androidunittest/src/main/java/com/github/florent37/androidunittest/controllers/ControllerActivity.java",
    "content": "package com.github.florent37.androidunittest.controllers;\n\nimport android.app.Activity;\nimport android.support.annotation.Nullable;\n\nimport com.github.florent37.androidunittest.AndroidUnitTest;\nimport com.github.florent37.androidunittest.annotations.RActivity;\nimport com.github.florent37.androidunittest.states.ActivityState;\n\nimport org.mockito.Mockito;\nimport org.robolectric.Robolectric;\nimport org.robolectric.util.ActivityController;\n\n/**\n * Created by florentchampigny on 08/05/2016.\n */\npublic class ControllerActivity {\n\n    private AndroidUnitTest androidUnitTest;\n\n    public ControllerActivity(AndroidUnitTest androidUnitTest) {\n        this.androidUnitTest = androidUnitTest;\n    }\n\n    @Nullable\n    public Activity get() {\n        if (androidUnitTest.getActivityController() != null) {\n            return (Activity) androidUnitTest.getActivityController().get();\n        }\n        return null;\n    }\n\n    @Nullable\n    public ActivityController getActivityController() {\n        if (androidUnitTest.getActivityController() != null) {\n            return androidUnitTest.getActivityController();\n        }\n        return null;\n    }\n\n    public Activity createAndInitActivity(Class activityClass, @Nullable RActivity activityAnnotation) {\n        ActivityController activityController = ActivityController.of(Robolectric.getShadowsAdapter(), activityClass);\n        androidUnitTest.setActivityController(activityController);\n        if (activityAnnotation != null) {\n            ActivityState activityState = activityAnnotation.state();\n            setActivityState(activityController, activityState);\n        }\n        Activity activity = (Activity) activityController.get();\n        return Mockito.spy(activity);\n    }\n\n    public ControllerActivity resume() {\n        if (androidUnitTest.getActivityController() != null) {\n            androidUnitTest.getActivityController().resume();\n            androidUnitTest.getAndroidUnitTestAnnotations().updateActivity();\n        }\n        return this;\n    }\n\n    public ControllerActivity create() {\n        if (androidUnitTest.getActivityController() != null) {\n            androidUnitTest.getActivityController().create();\n            androidUnitTest.getAndroidUnitTestAnnotations().updateActivity();\n        }\n        return this;\n    }\n\n    public ControllerActivity start() {\n        if (androidUnitTest.getActivityController() != null) {\n            androidUnitTest.getActivityController().start();\n            androidUnitTest.getAndroidUnitTestAnnotations().updateActivity();\n        }\n        return this;\n    }\n\n    public ControllerActivity pause() {\n        if (androidUnitTest.getActivityController() != null) {\n            androidUnitTest.getActivityController().pause();\n            androidUnitTest.getAndroidUnitTestAnnotations().updateActivity();\n        }\n        return this;\n    }\n\n    public ControllerActivity stop() {\n        if (androidUnitTest.getActivityController() != null) {\n            androidUnitTest.getActivityController().stop();\n            androidUnitTest.getAndroidUnitTestAnnotations().updateActivity();\n        }\n        return this;\n    }\n\n    public ControllerActivity destroy() {\n        if (androidUnitTest.getActivityController() != null) {\n            androidUnitTest.getActivityController().destroy();\n            androidUnitTest.getAndroidUnitTestAnnotations().updateActivity();\n        }\n        return this;\n    }\n\n    public ControllerActivity setActivityState(ActivityState activityState) {\n        if (androidUnitTest.getActivityController() != null) {\n            setActivityState(getActivityController(), activityState);\n        }\n        return this;\n    }\n\n    public ControllerActivity setActivityState(ActivityController activityController, ActivityState activityState) {\n        ActivityState init = ActivityState.CREATED;\n\n        while (init != null && init.isLowerOrEquals(activityState)) {\n            System.out.println(init);\n            applyState(init, activityController);\n            init = init.next();\n        }\n\n        return this;\n    }\n\n    private void applyState(ActivityState state,\n                            ActivityController controller) {\n        switch (state) {\n            case STARTED:\n                controller.start();\n                break;\n            case RESUMED:\n                controller.resume();\n                break;\n            case PAUSED:\n                controller.pause();\n                break;\n            case STOPPED:\n                controller.stop();\n                break;\n            case DESTROYED:\n                controller.destroy();\n                break;\n            case CREATED:\n            default:\n                controller.create();\n                break;\n        }\n    }\n\n}\n"
  },
  {
    "path": "androidunittest/src/main/java/com/github/florent37/androidunittest/controllers/ControllerFragment.java",
    "content": "package com.github.florent37.androidunittest.controllers;\n\nimport android.support.v4.app.Fragment;\n\nimport com.github.florent37.androidunittest.AndroidUnitTest;\n\n/**\n * Created by florentchampigny on 08/05/2016.\n */\npublic class ControllerFragment {\n    private AndroidUnitTest androidUnitTest;\n    public ControllerFragment(AndroidUnitTest androidUnitTest) {\n        this.androidUnitTest = androidUnitTest;\n    }\n\n    public ControllerFragment attachToActivity(Fragment fragment){\n        if (androidUnitTest.activity().get() == null) {\n\n        }\n        androidUnitTest.getAndroidUnitTestAnnotations().addToActivity(fragment);\n        return this;\n    }\n\n    public ControllerFragment removeFromActivity(Fragment fragment){\n        androidUnitTest.getAndroidUnitTestAnnotations().removeFromActivity(fragment);\n        return this;\n    }\n}\n"
  },
  {
    "path": "androidunittest/src/main/java/com/github/florent37/androidunittest/managers/AbstractAnnotationManager.java",
    "content": "package com.github.florent37.androidunittest.managers;\n\nimport android.content.Context;\nimport android.support.annotation.NonNull;\n\nimport com.github.florent37.androidunittest.AndroidUnitTest;\n\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Field;\n\n/**\n * Created by kevinleperf on 18/05/16.\n */\npublic abstract class AbstractAnnotationManager {\n    private AndroidUnitTest mAndroidUnitTest;\n\n    private AbstractAnnotationManager() {\n\n    }\n\n    public AbstractAnnotationManager(AndroidUnitTest parent) {\n        this();\n\n        mAndroidUnitTest = parent;\n    }\n\n    public final boolean canManage(@NonNull Field field) {\n        return field.isAnnotationPresent(canManagerInternal());\n    }\n\n    @NonNull\n    protected abstract Class<? extends Annotation> canManagerInternal();\n\n    /**\n     * Method called by the AndroidUnitTestAnnotations class\n     * during the scan() method\n     *\n     * @param field the scanned field to manage internally\n     */\n    public abstract void scanned(@NonNull Field field);\n\n    /**\n     * Method called by the AndroidUnitTestAnnotations class\n     * during the execute() method\n     *\n     * @param object  the object to be applied\n     * @param context the current app context\n     */\n    public abstract void execute(@NonNull Object object,\n                                 @NonNull Context context);\n\n    @NonNull\n    protected AndroidUnitTest getAndroidUnitTest() {\n        return mAndroidUnitTest;\n    }\n\n}\n"
  },
  {
    "path": "androidunittest/src/main/java/com/github/florent37/androidunittest/managers/AnnotationActivityManager.java",
    "content": "package com.github.florent37.androidunittest.managers;\n\nimport android.app.Activity;\nimport android.content.Context;\nimport android.support.annotation.NonNull;\nimport android.support.annotation.Nullable;\nimport android.support.annotation.VisibleForTesting;\n\nimport com.github.florent37.androidunittest.AndroidUnitTest;\nimport com.github.florent37.androidunittest.annotations.RActivity;\n\nimport org.mockito.internal.util.reflection.FieldSetter;\n\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Field;\n\n/**\n * Created by kevinleperf on 18/05/16.\n */\npublic class AnnotationActivityManager extends AbstractAnnotationManager {\n\n    @VisibleForTesting Field activityField;\n\n    public AnnotationActivityManager(AndroidUnitTest parent) {\n        super(parent);\n\n        //createAndInitActivity(null, FragmentActivity.class, null);\n        //parent.activity().setActivityState(ActivityState.CREATED);\n        //useless create() here since in createAndInitActivity\n        //parent.getActivityController().create();\n    }\n\n    @Override\n    public void scanned(@NonNull Field field) {\n        activityField = field;\n    }\n\n    @Override\n    public void execute(@NonNull Object object, @NonNull Context context) {\n        if (activityField != null) {\n            createAndInitActivity(object,\n                    activityField.getType(),\n                    activityField.getAnnotation(RActivity.class));\n        }//activityField is null, using standard FragmentActivity from constructor\n    }\n\n    public Field getScanned() {\n        return activityField;\n    }\n\n    public void createAndInitActivity(@Nullable Object target, Class activityClass, @Nullable RActivity activityAnnotation) {\n        Activity activity = getAndroidUnitTest().activity().createAndInitActivity(activityClass, activityAnnotation);\n        if (this.activityField != null && target != null) {\n            new FieldSetter(target, this.activityField).set(activity);\n        }\n    }\n\n    public void updateActivity(Object target) {\n        new FieldSetter(target, this.activityField)\n                .set(getAndroidUnitTest().getActivityController().get());\n    }\n\n    @NonNull\n    @Override\n    protected Class<? extends Annotation> canManagerInternal() {\n        return RActivity.class;\n    }\n}\n"
  },
  {
    "path": "androidunittest/src/main/java/com/github/florent37/androidunittest/managers/AnnotationContextManager.java",
    "content": "package com.github.florent37.androidunittest.managers;\n\nimport android.content.Context;\nimport android.support.annotation.NonNull;\nimport android.support.annotation.VisibleForTesting;\n\nimport com.github.florent37.androidunittest.AndroidUnitTest;\nimport com.github.florent37.androidunittest.annotations.RContext;\n\nimport org.mockito.Mockito;\nimport org.mockito.internal.util.reflection.FieldSetter;\n\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Field;\n\n/**\n * Created by kevinleperf on 18/05/16.\n */\npublic class AnnotationContextManager extends AbstractAnnotationManager {\n\n    @VisibleForTesting Field contextField;\n\n    public AnnotationContextManager(AndroidUnitTest parent) {\n        super(parent);\n    }\n\n    @Override\n    public void scanned(@NonNull Field field) {\n        contextField = field;\n    }\n\n    @Override\n    public void execute(@NonNull Object target, @NonNull Context context) {\n        if (contextField != null) {\n            Context appContext = context;\n            appContext = Mockito.spy(appContext);\n            new FieldSetter(target, this.contextField).set(appContext);\n        }\n    }\n\n    @NonNull\n    @Override\n    protected Class<? extends Annotation> canManagerInternal() {\n        return RContext.class;\n    }\n}\n"
  },
  {
    "path": "androidunittest/src/main/java/com/github/florent37/androidunittest/managers/AnnotationFragmentManager.java",
    "content": "package com.github.florent37.androidunittest.managers;\n\nimport android.app.Activity;\nimport android.content.Context;\nimport android.support.annotation.NonNull;\nimport android.support.annotation.VisibleForTesting;\nimport android.support.v4.app.Fragment;\nimport android.support.v4.app.FragmentActivity;\n\nimport com.github.florent37.androidunittest.AndroidUnitTest;\nimport com.github.florent37.androidunittest.annotations.RFragment;\nimport com.github.florent37.androidunittest.controllers.ControllerActivity;\nimport com.github.florent37.androidunittest.states.ActivityState;\n\nimport org.mockito.Mockito;\nimport org.mockito.internal.util.reflection.FieldReader;\nimport org.mockito.internal.util.reflection.FieldSetter;\n\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Field;\nimport java.util.HashSet;\n\n/**\n * Created by kevinleperf on 18/05/16.\n */\npublic class AnnotationFragmentManager extends AbstractAnnotationManager {\n    @VisibleForTesting final HashSet<Field> fragmentFields;\n\n    public AnnotationFragmentManager(AndroidUnitTest parent) {\n        super(parent);\n\n        fragmentFields = new HashSet<>();\n    }\n\n    public static void addToActivity(Activity activity, Fragment fragment, String tag) {\n        if (activity instanceof FragmentActivity) {\n            FragmentActivity fragmentActivity = (FragmentActivity) activity;\n            fragmentActivity.getSupportFragmentManager().beginTransaction()\n                .add(fragment, tag)\n                .commit();\n        }\n    }\n\n    public static void removeFromActivity(Activity activity, Fragment fragment) {\n        if (activity instanceof FragmentActivity) {\n            FragmentActivity fragmentActivity = (FragmentActivity) activity;\n            fragmentActivity.getSupportFragmentManager().beginTransaction()\n                .remove(fragment)\n                .commit();\n        }\n    }\n\n    @Override\n    public void scanned(@NonNull Field field) {\n        fragmentFields.add(field);\n    }\n\n    @Override\n    public void execute(@NonNull Object object, @NonNull Context context) {\n        for (Field fragment : fragmentFields) {\n            initFragment(object, fragment);\n        }\n    }\n\n    public void initFragment(@NonNull Object target, @NonNull Field fragmentField) {\n        RFragment fragmentAnnotation = fragmentField.getAnnotation(RFragment.class);\n\n        Class fragmentClass = fragmentField.getType();\n        Fragment fragment = null;\n        try {\n            fragment = (Fragment) fragmentClass.newInstance();\n        } catch (Exception e) {\n            e.printStackTrace();\n            throw new IllegalStateException(\"Impossible to instantiate a fragment using the default constructor\");\n        }\n\n        fragment = Mockito.spy(fragment);\n        new FieldSetter(target, fragmentField).set(fragment);\n\n        //if no activity is create, the default activity manager behaviour is to create one\n        /*if (this.activityField == null) {\n            createActivity(FragmentActivity.class, null);\n            androidUnitTest.activity().setActivityState(ActivityState.CREATED);\n        }*/\n\n        if (fragmentAnnotation.attached()) {\n            String tag = fragmentAnnotation.tag();\n            if (tag == null || tag.isEmpty()) {\n                tag = fragment.getClass().toString();\n            }\n            addToActivity(getActivity(), fragment, tag);\n        }\n    }\n\n    public void addToActivity(@NonNull Object target, Fragment fragment) {\n        String tag = null;\n        for (Field fragmentField : fragmentFields) {\n            Fragment fragmentOfField = (Fragment) new FieldReader(target, fragmentField).read();\n            if (fragment == fragmentOfField) {\n                RFragment fragmentAnnotation = fragmentField.getAnnotation(RFragment.class);\n                tag = fragmentAnnotation.tag();\n            }\n        }\n        if (tag == null || tag.isEmpty()) {\n            tag = fragment.getClass().toString();\n        }\n\n        ControllerActivity controllerActivity = getAndroidUnitTest().activity();\n        //if no activity is create, the default activity manager behaviour is to create one\n        if (controllerActivity.get() == null) {\n            controllerActivity.createAndInitActivity(FragmentActivity.class, null);\n            controllerActivity.setActivityState(ActivityState.CREATED);\n        }\n\n        AnnotationFragmentManager.addToActivity(getActivity(), fragment, tag);\n    }\n\n    public void removeFromActivity(Fragment fragment) {\n        AnnotationFragmentManager.removeFromActivity(getActivity(), fragment);\n    }\n\n    @NonNull\n    @Override\n    protected Class<? extends Annotation> canManagerInternal() {\n        return RFragment.class;\n    }\n\n    private Activity getActivity() {\n        return getAndroidUnitTest().activity().get();\n    }\n}\n"
  },
  {
    "path": "androidunittest/src/main/java/com/github/florent37/androidunittest/managers/AnnotationViewManager.java",
    "content": "package com.github.florent37.androidunittest.managers;\n\nimport android.content.Context;\nimport android.support.annotation.NonNull;\nimport android.support.annotation.VisibleForTesting;\nimport android.view.View;\n\nimport com.github.florent37.androidunittest.AndroidUnitTest;\nimport com.github.florent37.androidunittest.annotations.RView;\n\nimport org.mockito.Mockito;\nimport org.mockito.internal.util.reflection.FieldSetter;\n\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Field;\nimport java.util.HashSet;\nimport java.util.Set;\n\n/**\n * Created by kevinleperf on 18/05/16.\n */\npublic class AnnotationViewManager extends AbstractAnnotationManager {\n\n    @VisibleForTesting Set<Field> fields;\n\n    public AnnotationViewManager(AndroidUnitTest androidUnitTest) {\n        super(androidUnitTest);\n\n        fields = new HashSet<>();\n    }\n\n    @Override\n    public void scanned(@NonNull Field field) {\n        fields.add(field);\n    }\n\n    @Override\n    public void execute(@NonNull Object object, @NonNull Context context) {\n        for (Field view : fields) {\n            initView(object, context, view);\n        }\n    }\n\n    @NonNull\n    @Override\n    protected Class<? extends Annotation> canManagerInternal() {\n        return RView.class;\n    }\n\n    private void initView(@NonNull Object target, @NonNull Context context, @NonNull Field viewField) {\n        Class viewClass = viewField.getType();\n        View view = null;\n        try {\n            view = (View) viewClass.getDeclaredConstructor(Context.class).newInstance(context);\n        } catch (Exception e) {\n            e.printStackTrace();\n        }\n        view = Mockito.spy(view);\n        new FieldSetter(target, viewField).set(view);\n    }\n\n}\n"
  },
  {
    "path": "androidunittest/src/main/java/com/github/florent37/androidunittest/states/ActivityState.java",
    "content": "package com.github.florent37.androidunittest.states;\n\nimport android.support.annotation.NonNull;\n\n/**\n * Created by kevinleperf on 14/05/16.\n * <p/>\n * A ActivityState describe the initial state of an activity at binding\n */\npublic enum ActivityState {\n    //reverse ordered to prevent illegal forward reference\n    DESTROYED(null),\n    STOPPED(ActivityState.DESTROYED),\n    PAUSED(ActivityState.STOPPED),\n    RESUMED(ActivityState.PAUSED),\n    STARTED(ActivityState.RESUMED),\n    CREATED(ActivityState.STARTED);\n\n\n    private ActivityState mNext;\n\n    ActivityState(ActivityState next) {\n        mNext = next;\n    }\n\n    public ActivityState next() {\n        return mNext;\n    }\n\n    /**\n     * Check wether the given ActivityState is before or at least the same element as this instance\n     *\n     * commonly used to check if the previous state can be call\n     * for instance, checking if Resume can be used before Paused, it will returns true\n     * whereas, testing destroy against resume will return false\n     * @param state\n     * @return\n     */\n    public boolean isLowerOrEquals(@NonNull ActivityState state) {\n        return ordinal() >= state.ordinal(); //since we are in the reverse order\n        //it is not <= but =>\n    }\n}\n"
  },
  {
    "path": "androidunittest/src/main/res/values/strings.xml",
    "content": "<resources>\n    <string name=\"app_name\">AndroidUnitTest</string>\n</resources>\n"
  },
  {
    "path": "androidunittest/src/test/java/com/github/florent37/androidunittest/managers/AnnotationActivityManagerTest.java",
    "content": "package com.github.florent37.androidunittest.managers;\n\nimport android.app.Activity;\nimport android.app.Application;\nimport android.content.Context;\nimport android.os.Bundle;\n\nimport com.github.florent37.androidunittest.AndroidUnitTest;\nimport com.github.florent37.androidunittest.annotations.RActivity;\nimport com.github.florent37.androidunittest.controllers.ControllerActivity;\nimport com.github.florent37.androidunittest.states.ActivityState;\n\nimport org.junit.Before;\nimport org.junit.Rule;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnit;\nimport org.mockito.junit.MockitoRule;\nimport org.robolectric.RobolectricTestRunner;\nimport org.robolectric.annotation.Config;\nimport org.robolectric.util.ActivityController;\n\nimport java.lang.reflect.Field;\n\nimport static com.google.common.truth.Truth.assertThat;\nimport static org.mockito.BDDMockito.given;\nimport static org.mockito.Matchers.any;\nimport static org.mockito.Mockito.verify;\n\n/**\n * Created by florentchampigny on 19/05/2016.\n */\n@RunWith(RobolectricTestRunner.class)\n@Config(manifest = Config.NONE)\npublic class AnnotationActivityManagerTest {\n\n    @Rule public MockitoRule rule = MockitoJUnit.rule();\n\n    @Mock AndroidUnitTest androidUnitTest;\n    ControllerActivity controllerActivity;\n    @Mock Activity activity;\n    @InjectMocks AnnotationActivityManager manager;\n\n    @Before\n    public void setUp() throws Exception {\n        controllerActivity = new ControllerActivity(androidUnitTest);\n        given(androidUnitTest.activity()).willReturn(controllerActivity);\n    }\n\n    @Test\n    public void testCanManagerInternal() throws Exception {\n        // Given\n        // When\n        Object canManage = manager.canManagerInternal();\n        // Then\n        assertThat(canManage).isNotNull();\n        assertThat(canManage).isEqualTo(RActivity.class);\n    }\n\n    @Test\n    public void testScanned() throws Exception {\n        // Given\n        TestObject testObject = new TestObject();\n        Field field = testObject.getClass().getDeclaredField(\"activity\");\n        // When\n        manager.scanned(field);\n        // Then\n        assertThat(manager.activityField).isEqualTo(field);\n    }\n\n    @Test\n    public void testExecute() throws Exception {\n        // Given\n        TestObject testObject = new TestObject();\n        Context context = new Application();\n        manager.activityField = testObject.getClass().getDeclaredField(\"activity\");\n        // When\n        manager.execute(testObject, context);\n        //Then\n        assertThat(testObject.activity).isNotNull();\n        assertThat(testObject.activity.created).isTrue();\n        verify(androidUnitTest).setActivityController(any(ActivityController.class));\n    }\n\n    @Test\n    public void testExecuteState() throws Exception {\n        // Given\n        TestObjectState testObject = new TestObjectState();\n        Context context = new Application();\n        manager.activityField = testObject.getClass().getDeclaredField(\"activity\");\n        // When\n        manager.execute(testObject, context);\n        //Then\n        assertThat(testObject.activity).isNotNull();\n        assertThat(testObject.activity.created).isTrue();\n        assertThat(testObject.activity.started).isTrue();\n        assertThat(testObject.activity.resumed).isTrue();\n        verify(androidUnitTest).setActivityController(any(ActivityController.class));\n    }\n\n    static class TestObject {\n        @RActivity TestActivity activity;\n    }\n\n    static class TestObjectState {\n        @RActivity(state = ActivityState.RESUMED) TestActivity activity;\n    }\n\n    static class TestActivity extends Activity {\n        boolean created = false;\n        boolean resumed = false;\n        boolean started = false;\n\n        @Override\n        protected void onCreate(Bundle savedInstanceState) {\n            super.onCreate(savedInstanceState);\n            created = true;\n        }\n\n        @Override\n        protected void onStart() {\n            super.onStart();\n            started = true;\n        }\n\n        @Override\n        protected void onResume() {\n            super.onResume();\n            resumed = true;\n        }\n    }\n}"
  },
  {
    "path": "androidunittest/src/test/java/com/github/florent37/androidunittest/managers/AnnotationContextManagerTest.java",
    "content": "package com.github.florent37.androidunittest.managers;\n\nimport android.app.Application;\nimport android.content.Context;\n\nimport com.github.florent37.androidunittest.AndroidUnitTest;\nimport com.github.florent37.androidunittest.annotations.RContext;\n\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.runners.MockitoJUnitRunner;\n\nimport java.lang.reflect.Field;\n\nimport static com.google.common.truth.Truth.assertThat;\n\n/**\n * Created by florentchampigny on 19/05/2016.\n */\n@RunWith(MockitoJUnitRunner.class)\npublic class AnnotationContextManagerTest {\n\n    @Mock AndroidUnitTest androidUnitTest;\n    @InjectMocks AnnotationContextManager manager;\n\n    @Test\n    public void testCanManagerInternal() throws Exception {\n        // Given\n        // When\n        Object canManage = manager.canManagerInternal();\n        // Then\n        assertThat(canManage).isNotNull();\n        assertThat(canManage).isEqualTo(RContext.class);\n    }\n\n    @Test\n    public void testScanned() throws Exception {\n        // Given\n        TestObject testObject = new TestObject();\n        Field field = testObject.getClass().getDeclaredField(\"context\");\n        // When\n        manager.scanned(field);\n        // Then\n        assertThat(manager.contextField).isEqualTo(field);\n    }\n\n    @Test\n    public void testExecute() throws Exception {\n        // Given\n        TestObject testObject = new TestObject();\n        Context context = new Application();\n        manager.contextField = testObject.getClass().getDeclaredField(\"context\");\n        // When\n        manager.execute(testObject, context);\n        //Then\n        assertThat(testObject.context).isNotNull();\n    }\n\n    static class TestObject {\n        @RContext Context context;\n    }\n}"
  },
  {
    "path": "androidunittest/src/test/java/com/github/florent37/androidunittest/managers/AnnotationFragmentManagerTest.java",
    "content": "package com.github.florent37.androidunittest.managers;\n\nimport android.app.Application;\nimport android.content.Context;\nimport android.support.v4.app.Fragment;\nimport android.support.v4.app.FragmentActivity;\n\nimport com.github.florent37.androidunittest.AndroidUnitTest;\nimport com.github.florent37.androidunittest.annotations.RFragment;\n\nimport org.junit.Before;\nimport org.junit.Rule;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.junit.MockitoJUnit;\nimport org.mockito.junit.MockitoRule;\nimport org.robolectric.Robolectric;\nimport org.robolectric.RobolectricTestRunner;\nimport org.robolectric.annotation.Config;\n\nimport java.lang.reflect.Field;\n\nimport static com.google.common.truth.Truth.assertThat;\n\n/**\n * Created by florentchampigny on 19/05/2016.\n */\n@RunWith(RobolectricTestRunner.class)\n@Config(manifest = Config.NONE)\npublic class AnnotationFragmentManagerTest {\n\n    @Rule public MockitoRule rule = MockitoJUnit.rule();\n\n    AndroidUnitTest androidUnitTest;\n    AnnotationFragmentManager manager;\n\n    @Before\n    public void setUp() throws Exception {\n        androidUnitTest = AndroidUnitTest.rule();\n        manager = new AnnotationFragmentManager(androidUnitTest);\n    }\n\n    @Test\n    public void testCanManagerInternal() throws Exception {\n        // Given\n        // When\n        Object canManage = manager.canManagerInternal();\n        // Then\n        assertThat(canManage).isNotNull();\n        assertThat(canManage).isEqualTo(RFragment.class);\n    }\n\n    @Test\n    public void testScanned() throws Exception {\n        // Given\n        TestObject testObject = new TestObject();\n        Field field = testObject.getClass().getDeclaredField(\"fragment1\");\n        // When\n        manager.scanned(field);\n        // Then\n        assertThat(manager.fragmentFields).contains(field);\n    }\n\n    @Test\n    public void testExecute() throws Exception {\n        // Given\n        TestObject testObject = new TestObject();\n        Context context = new Application();\n        manager.fragmentFields.add(testObject.getClass().getDeclaredField(\"fragment1\"));\n        manager.fragmentFields.add(testObject.getClass().getDeclaredField(\"fragment2\"));\n        // When\n        manager.execute(testObject, context);\n        //Then\n        assertThat(testObject.fragment1).isNotNull();\n        assertThat(testObject.fragment2).isNotNull();\n    }\n\n    @Test\n    public void testAddToActivity() throws Exception {\n        // Given\n        TestObject target = new TestObject();\n        target.fragment1 = new Fragment();\n        // When\n        manager.addToActivity(target, target.fragment1);\n        // Then\n        assertThat(target.fragment1.getActivity()).isNotNull();\n    }\n\n    @Test\n    public void testRemoveFromActivity() throws Exception {\n        // Given\n        TestObject target = new TestObject();\n        target.fragment1 = new Fragment();\n        manager.addToActivity(target, target.fragment1);\n        // When\n        manager.removeFromActivity(target.fragment1);\n        // Then\n        assertThat(target.fragment1.getActivity()).isNull();\n    }\n\n    @Test\n    public void testAddToActivityWithTag() throws Exception {\n        // Given\n        TestObject target = new TestObject();\n        FragmentActivity activity = Robolectric.buildActivity(FragmentActivity.class).create().get();\n        target.fragment1 = new Fragment();\n        String tag = \"TAG\";\n        // When\n        AnnotationFragmentManager.addToActivity(activity, target.fragment1, tag);\n        // Then\n        assertThat(target.fragment1.getActivity()).isNotNull();\n    }\n\n    static class TestObject {\n        @RFragment Fragment fragment1;\n        @RFragment Fragment fragment2;\n    }\n\n}"
  },
  {
    "path": "androidunittest/src/test/java/com/github/florent37/androidunittest/managers/AnnotationViewManagerTest.java",
    "content": "package com.github.florent37.androidunittest.managers;\n\nimport android.app.Application;\nimport android.content.Context;\nimport android.view.View;\nimport android.widget.TextView;\n\nimport com.github.florent37.androidunittest.AndroidUnitTest;\nimport com.github.florent37.androidunittest.annotations.RView;\n\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.runners.MockitoJUnitRunner;\n\nimport java.lang.reflect.Field;\n\nimport static com.google.common.truth.Truth.assertThat;\n\n/**\n * Created by florentchampigny on 19/05/2016.\n */\n@RunWith(MockitoJUnitRunner.class)\npublic class AnnotationViewManagerTest {\n\n    @Mock AndroidUnitTest androidUnitTest;\n    @InjectMocks AnnotationViewManager manager;\n\n    @Test\n    public void testCanManagerInternal() throws Exception {\n        // Given\n        // When\n        Object canManage = manager.canManagerInternal();\n        // Then\n        assertThat(canManage).isNotNull();\n        assertThat(canManage).isEqualTo(RView.class);\n    }\n\n    @Test\n    public void testScanned() throws Exception {\n        // Given\n        TestObject testObject = new TestObject();\n        Field field = testObject.getClass().getDeclaredField(\"view1\");\n        // When\n        manager.scanned(field);\n        // Then\n        assertThat(manager.fields).contains(field);\n    }\n\n    @Test\n    public void testExecute() throws Exception {\n        // Given\n        TestObject testObject = new TestObject();\n        Context context = new Application();\n        manager.fields.add(testObject.getClass().getDeclaredField(\"view1\"));\n        manager.fields.add(testObject.getClass().getDeclaredField(\"view2\"));\n        // When\n        manager.execute(testObject, context);\n        //Then\n        assertThat(testObject.view1).isNotNull();\n        assertThat(testObject.view2).isNotNull();\n    }\n\n    static class TestObject {\n        @RView View view1;\n        @RView TextView view2;\n    }\n}"
  },
  {
    "path": "app/.gitignore",
    "content": "/build\n"
  },
  {
    "path": "app/build.gradle",
    "content": "apply plugin: 'com.android.application'\n\nandroid {\n    compileSdkVersion project.sdk\n    buildToolsVersion project.buildTools\n\n    defaultConfig {\n        applicationId \"com.github.florent37.testsample\"\n        minSdkVersion project.minSdk\n        targetSdkVersion project.sdk\n        versionCode 1\n        versionName \"1.0\"\n    }\n    buildTypes {\n        release {\n            minifyEnabled false\n            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'\n        }\n    }\n}\n\ndependencies {\n    compile fileTree(dir: 'libs', include: ['*.jar'])\n    compile 'com.android.support:appcompat-v7:'+project.supportVersion\n    compile 'com.android.support:support-annotations:'+project.supportVersion\n\n    testCompile project(\":androidunittest\")\n    testCompile 'com.google.truth:truth:0.28'\n}\n"
  },
  {
    "path": "app/proguard-rules.pro",
    "content": "# Add project specific ProGuard rules here.\n# By default, the flags in this file are appended to flags specified\n# in /Users/florentchampigny/Android/sdk/tools/proguard/proguard-android.txt\n# You can edit the include path and order by changing the proguardFiles\n# directive in build.gradle.\n#\n# For more details, see\n#   http://developer.android.com/guide/developing/tools/proguard.html\n\n# Add any project specific keep options here:\n\n# If your project uses WebView with JS, uncomment the following\n# and specify the fully qualified class name to the JavaScript interface\n# class:\n#-keepclassmembers class fqcn.of.javascript.interface.for.webview {\n#   public *;\n#}\n"
  },
  {
    "path": "app/src/androidTest/java/com/github/florent37/androidunittest/ApplicationTest.java",
    "content": "package com.github.florent37.androidunittest;\n\nimport android.app.Application;\nimport android.test.ApplicationTestCase;\n\n/**\n * <a href=\"http://d.android.com/tools/testing/testing_android.html\">Testing Fundamentals</a>\n */\npublic class ApplicationTest extends ApplicationTestCase<Application> {\n    public ApplicationTest() {\n        super(Application.class);\n    }\n}"
  },
  {
    "path": "app/src/main/AndroidManifest.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<manifest package=\"com.github.florent37.testsample\"\n          xmlns:android=\"http://schemas.android.com/apk/res/android\">\n\n    <application\n        android:allowBackup=\"true\"\n        android:icon=\"@mipmap/ic_launcher\"\n        android:label=\"@string/app_name\"\n        android:supportsRtl=\"true\"\n        android:name=\".MyApplication\"\n        android:theme=\"@style/AppTheme\">\n        <activity android:name=\".MainActivity\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\"/>\n\n                <category android:name=\"android.intent.category.LAUNCHER\"/>\n            </intent-filter>\n        </activity>\n    </application>\n\n</manifest>"
  },
  {
    "path": "app/src/main/java/com/github/florent37/testsample/MainActivity.java",
    "content": "package com.github.florent37.testsample;\n\nimport android.os.Bundle;\nimport android.support.v7.app.AppCompatActivity;\nimport android.widget.TextView;\n\nimport com.github.florent37.testsample.model.User;\n\npublic class MainActivity extends AppCompatActivity {\n\n    TextView textView;\n\n    boolean created = false;\n    boolean resumed = false;\n    boolean started = false;\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_main);\n\n        this.textView = (TextView) findViewById(R.id.textView);\n        created = true;\n    }\n\n    @Override\n    protected void onStart() {\n        super.onStart();\n        started = true;\n    }\n\n    @Override\n    protected void onResume() {\n        super.onResume();\n        resumed = true;\n    }\n\n    public void display(User user) {\n        this.textView.setText(user.getName());\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/florent37/testsample/MainFragment.java",
    "content": "package com.github.florent37.testsample;\n\nimport android.os.Bundle;\nimport android.support.annotation.Nullable;\nimport android.support.v4.app.Fragment;\nimport android.view.LayoutInflater;\nimport android.view.View;\nimport android.view.ViewGroup;\n\n/**\n * Created by florentchampigny on 08/05/2016.\n */\npublic class MainFragment extends Fragment{\n\n    @Nullable\n    @Override\n    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {\n        return inflater.inflate(R.layout.fragment_main, container, false);\n    }\n\n    @Override\n    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {\n        super.onViewCreated(view, savedInstanceState);\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/florent37/testsample/MainView.java",
    "content": "package com.github.florent37.testsample;\n\nimport android.content.Context;\nimport android.util.AttributeSet;\nimport android.widget.FrameLayout;\n\nimport com.github.florent37.testsample.model.User;\n\n/**\n * Created by florentchampigny on 08/05/2016.\n */\npublic class MainView extends FrameLayout {\n    public MainView(Context context) {\n        this(context, null);\n    }\n\n    public MainView(Context context, AttributeSet attrs) {\n        this(context, attrs, 0);\n    }\n\n    public MainView(Context context, AttributeSet attrs, int defStyleAttr) {\n        super(context, attrs, defStyleAttr);\n    }\n\n    protected void displayText(String text){\n\n    }\n\n    public void display(User user){\n        displayText(user.getName());\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/florent37/testsample/MyApplication.java",
    "content": "package com.github.florent37.testsample;\n\nimport android.app.Application;\n\n/**\n * Created by florentchampigny on 07/05/2016.\n */\npublic class MyApplication extends Application {\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/florent37/testsample/model/User.java",
    "content": "package com.github.florent37.testsample.model;\n\n/**\n * Created by florentchampigny on 08/05/2016.\n */\npublic class User {\n    String name;\n\n    public String getName() {\n        return name;\n    }\n\n    public void setName(String name) {\n        this.name = name;\n    }\n}\n"
  },
  {
    "path": "app/src/main/res/layout/activity_main.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:paddingBottom=\"@dimen/activity_vertical_margin\"\n    android:paddingLeft=\"@dimen/activity_horizontal_margin\"\n    android:paddingRight=\"@dimen/activity_horizontal_margin\"\n    android:paddingTop=\"@dimen/activity_vertical_margin\">\n\n    <TextView\n        android:id=\"@+id/textView\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:text=\"Hello World!\"/>\n</RelativeLayout>\n"
  },
  {
    "path": "app/src/main/res/layout/fragment_main.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n              android:orientation=\"vertical\"\n              android:layout_width=\"match_parent\"\n              android:layout_height=\"match_parent\">\n\n</LinearLayout>"
  },
  {
    "path": "app/src/main/res/values/colors.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <color name=\"colorPrimary\">#3F51B5</color>\n    <color name=\"colorPrimaryDark\">#303F9F</color>\n    <color name=\"colorAccent\">#FF4081</color>\n</resources>\n"
  },
  {
    "path": "app/src/main/res/values/dimens.xml",
    "content": "<resources>\n    <!-- Default screen margins, per the Android Design guidelines. -->\n    <dimen name=\"activity_horizontal_margin\">16dp</dimen>\n    <dimen name=\"activity_vertical_margin\">16dp</dimen>\n</resources>\n"
  },
  {
    "path": "app/src/main/res/values/strings.xml",
    "content": "<resources>\n    <string name=\"app_name\">AndroidUnitTest</string>\n</resources>\n"
  },
  {
    "path": "app/src/main/res/values/styles.xml",
    "content": "<resources>\n\n    <!-- Base application theme. -->\n    <style name=\"AppTheme\" parent=\"Theme.AppCompat.Light.DarkActionBar\">\n        <!-- Customize your theme here. -->\n        <item name=\"colorPrimary\">@color/colorPrimary</item>\n        <item name=\"colorPrimaryDark\">@color/colorPrimaryDark</item>\n        <item name=\"colorAccent\">@color/colorAccent</item>\n    </style>\n\n</resources>\n"
  },
  {
    "path": "app/src/main/res/values-w820dp/dimens.xml",
    "content": "<resources>\n    <!-- Example customization of dimensions originally defined in res/values/dimens.xml\n         (such as screen margins) for screens with more than 820dp of available width. This\n         would include 7\" and 10\" devices in landscape (~960dp and ~1280dp respectively). -->\n    <dimen name=\"activity_horizontal_margin\">64dp</dimen>\n</resources>\n"
  },
  {
    "path": "app/src/test/java/com/github/florent37/testsample/BasicActivityTest.java",
    "content": "package com.github.florent37.testsample;\n\nimport android.content.Context;\n\nimport com.github.florent37.androidunittest.AndroidUnitTest;\nimport com.github.florent37.androidunittest.annotations.RActivity;\nimport com.github.florent37.androidunittest.annotations.RContext;\nimport com.github.florent37.androidunittest.annotations.RView;\nimport com.github.florent37.testsample.model.User;\n\nimport org.junit.Rule;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\n\nimport static com.google.common.truth.Truth.assertThat;\n\n@RunWith(CustomTestRunner.class)\npublic class BasicActivityTest {\n    @Rule public AndroidUnitTest androidUnitTest = AndroidUnitTest.rule();\n\n    @RContext Context context;\n    @RActivity MainActivity activity;\n    @RView MainView view;\n\n    @Mock User user;\n\n    @Test\n    public void testAnnotations() throws Exception {\n        assertThat(context).isNotNull();\n        assertThat(activity).isNotNull();\n        assertThat(view).isNotNull();\n        assertThat(user).isNotNull();\n    }\n\n}\n"
  },
  {
    "path": "app/src/test/java/com/github/florent37/testsample/CustomTestRunner.java",
    "content": "package com.github.florent37.testsample;\n\nimport com.github.florent37.androidunittest.AndroidUnitTestRunner;\n\nimport org.junit.runners.model.InitializationError;\n\n/**\n * Created by florentchampigny on 07/05/2016.\n */\npublic class CustomTestRunner extends AndroidUnitTestRunner {\n    public CustomTestRunner(Class<?> testClass) throws InitializationError {\n        super(testClass, BuildConfig.FLAVOR, BuildConfig.BUILD_TYPE, BuildConfig.APPLICATION_ID, TestMyApplication.class);\n    }\n}\n"
  },
  {
    "path": "app/src/test/java/com/github/florent37/testsample/MainActivityTest.java",
    "content": "package com.github.florent37.testsample;\n\nimport com.github.florent37.androidunittest.AndroidUnitTest;\nimport com.github.florent37.androidunittest.annotations.RActivity;\nimport com.github.florent37.testsample.model.User;\n\nimport org.junit.Rule;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\n\nimport static com.google.common.truth.Truth.assertThat;\nimport static org.mockito.BDDMockito.given;\n\n@RunWith(CustomTestRunner.class)\npublic class MainActivityTest {\n    @Rule public AndroidUnitTest androidUnitTest = AndroidUnitTest.rule();\n\n    @RActivity MainActivity activity;\n\n    @Mock User user;\n\n    @Test\n    public void testDisplayUser() throws Exception {\n        // Given\n        given(user.getName()).willReturn(\"florent\");\n        // When\n        activity.display(user);\n        // Then\n        assertThat(activity.textView.getText()).isEqualTo(\"florent\");\n    }\n\n}\n"
  },
  {
    "path": "app/src/test/java/com/github/florent37/testsample/MainFragmentTest.java",
    "content": "package com.github.florent37.testsample;\n\nimport android.content.Context;\nimport android.support.v4.app.FragmentActivity;\n\nimport com.github.florent37.androidunittest.AndroidUnitTest;\nimport com.github.florent37.androidunittest.annotations.RActivity;\nimport com.github.florent37.androidunittest.annotations.RContext;\nimport com.github.florent37.androidunittest.annotations.RFragment;\n\nimport org.junit.Rule;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport static com.google.common.truth.Truth.assertThat;\nimport static org.mockito.Mockito.spy;\n\n@RunWith(CustomTestRunner.class)\npublic class MainFragmentTest {\n    @Rule public AndroidUnitTest androidUnitTest = AndroidUnitTest.rule();\n\n    @RContext Context context;\n    @RFragment(attached = false) MainFragment fragment;\n\n    @Test\n    public void testAnnotations() throws Exception {\n        assertThat(context).isNotNull();\n        assertThat(fragment).isNotNull();\n    }\n\n    @Test\n    public void testAttach() throws Exception {\n        // Given\n        assertThat(fragment.getActivity()).isNull();\n\n        // When\n        androidUnitTest.fragment().attachToActivity(fragment);\n\n        // Then\n        assertThat(fragment.getActivity()).isNotNull();\n    }\n\n}\n"
  },
  {
    "path": "app/src/test/java/com/github/florent37/testsample/MainFragmentWithActivityTest.java",
    "content": "package com.github.florent37.testsample;\n\nimport android.content.Context;\nimport android.support.v4.app.FragmentActivity;\n\nimport com.github.florent37.androidunittest.AndroidUnitTest;\nimport com.github.florent37.androidunittest.annotations.RActivity;\nimport com.github.florent37.androidunittest.annotations.RContext;\nimport com.github.florent37.androidunittest.annotations.RFragment;\n\nimport org.junit.Rule;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport static com.google.common.truth.Truth.assertThat;\n\n@RunWith(CustomTestRunner.class)\npublic class MainFragmentWithActivityTest {\n    @Rule public AndroidUnitTest androidUnitTest = AndroidUnitTest.rule();\n\n    @RContext Context context;\n    @RActivity FragmentActivity fragmentActivity;\n    @RFragment(attached = false, tag = \"monFragment\") MainFragment fragment;\n\n    @Test\n    public void testAnnotations() throws Exception {\n        assertThat(context).isNotNull();\n        assertThat(fragment).isNotNull();\n    }\n\n    @Test\n    public void testAttach() throws Exception {\n        // Given\n        assertThat(fragment.getActivity()).isNull();\n\n        // When\n        androidUnitTest.fragment().attachToActivity(fragment);\n\n        // Then\n        assertThat(fragment.getActivity()).isNotNull();\n        assertThat(fragmentActivity.getSupportFragmentManager().findFragmentByTag(\"monFragment\")).isNotNull();\n    }\n\n}\n"
  },
  {
    "path": "app/src/test/java/com/github/florent37/testsample/MainViewTest.java",
    "content": "package com.github.florent37.testsample;\n\nimport android.content.Context;\n\nimport com.github.florent37.androidunittest.AndroidUnitTest;\nimport com.github.florent37.androidunittest.annotations.RContext;\nimport com.github.florent37.androidunittest.annotations.RFragment;\nimport com.github.florent37.androidunittest.annotations.RView;\nimport com.github.florent37.testsample.model.User;\n\nimport org.junit.Rule;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\n\nimport static com.google.common.truth.Truth.assertThat;\nimport static org.mockito.BDDMockito.given;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(CustomTestRunner.class)\npublic class MainViewTest {\n    @Rule public AndroidUnitTest androidUnitTest = AndroidUnitTest.rule();\n\n    @RView MainView mainView;\n    @Mock User user;\n\n    @Test\n    public void testDisplayUser() throws Exception {\n        // Given\n        given(user.getName()).willReturn(\"florent\");\n        // When\n        mainView.display(user);\n        // Then\n        verify(mainView).displayText(\"florent\");\n    }\n\n\n}\n"
  },
  {
    "path": "app/src/test/java/com/github/florent37/testsample/StateActivityTest.java",
    "content": "package com.github.florent37.testsample;\n\nimport com.github.florent37.androidunittest.AndroidUnitTest;\nimport com.github.florent37.androidunittest.annotations.RActivity;\nimport com.github.florent37.androidunittest.states.ActivityState;\n\nimport org.junit.Rule;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport static com.google.common.truth.Truth.assertThat;\n\n@RunWith(CustomTestRunner.class)\npublic class StateActivityTest {\n    @Rule public AndroidUnitTest androidUnitTest = AndroidUnitTest.rule();\n\n    @RActivity(state = ActivityState.STARTED) MainActivity activity;\n\n    @Test\n    public void testAnnotations() throws Exception {\n        assertThat(activity.created).isTrue();\n        assertThat(activity.started).isTrue();\n        assertThat(activity.resumed).isFalse();\n    }\n\n}\n"
  },
  {
    "path": "app/src/test/java/com/github/florent37/testsample/TestMyApplication.java",
    "content": "package com.github.florent37.testsample;\n\n/**\n * Created by florentchampigny on 07/05/2016.\n */\npublic class TestMyApplication extends MyApplication {\n}\n"
  },
  {
    "path": "build.gradle",
    "content": "// Top-level build file where you can add configuration options common to all sub-projects/modules.\n\nbuildscript {\n    repositories {\n        jcenter()\n    }\n    dependencies {\n        classpath 'com.android.tools.build:gradle:2.1.0'\n        classpath \"org.jfrog.buildinfo:build-info-extractor-gradle:3.1.1\"\n        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'\n        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'\n\n        // NOTE: Do not place your application dependencies here; they belong\n        // in the individual module build.gradle files\n    }\n}\n\next {\n    sdk = 23\n    buildTools = \"23.0.3\"\n    minSdk = 10\n    libraryVersion = \"1.0.1\"\n    supportVersion = \"23.3.0\"\n}\n\nallprojects {\n    repositories {\n        jcenter()\n    }\n}\n\ntask clean(type: Delete) {\n    delete rootProject.buildDir\n}\n"
  },
  {
    "path": "gradle/bintray-android-v1.gradle",
    "content": "apply plugin: 'com.jfrog.bintray'\n\nversion = libraryVersion\n\ntask sourcesJar(type: Jar) {\n    from android.sourceSets.main.java.srcDirs\n    classifier = 'sources'\n}\n\ntask javadoc(type: Javadoc) {\n    source = android.sourceSets.main.java.srcDirs\n    classpath += project.files(android.getBootClasspath().join(File.pathSeparator))\n}\n\ntask javadocJar(type: Jar, dependsOn: javadoc) {\n    classifier = 'javadoc'\n    from javadoc.destinationDir\n}\nartifacts {\n    archives javadocJar\n    archives sourcesJar\n}\n\n// Bintray\nProperties properties = new Properties()\nproperties.load(project.rootProject.file('local.properties').newDataInputStream())\n\nbintray {\n    user = properties.getProperty(\"bintray.user\")\n    key = properties.getProperty(\"bintray.apikey\")\n\n    configurations = ['archives']\n    pkg {\n        repo = bintrayRepo\n        name = bintrayName\n        desc = libraryDescription\n        userOrg = orgName\n        websiteUrl = siteUrl\n        vcsUrl = gitUrl\n        licenses = allLicenses\n        publish = true\n        publicDownloadNumbers = true\n        version {\n            desc = libraryDescription\n            gpg {\n                sign = true //Determines whether to GPG sign the files. The default is false\n                passphrase = properties.getProperty(\"bintray.gpg.password\")\n                //Optional. The passphrase for GPG signing'\n            }\n        }\n    }\n}"
  },
  {
    "path": "gradle/bintray-java-v1.gradle",
    "content": "apply plugin: 'com.jfrog.bintray'\n\nversion = libraryVersion\n\ntask sourcesJar(type: Jar) {\n    from sourceSets.main.allSource\n    classifier = 'sources'\n}\n\ntask javadocJar(type: Jar, dependsOn: javadoc) {\n    classifier = 'javadoc'\n    from javadoc.destinationDir\n}\nartifacts {\n    archives javadocJar\n    archives sourcesJar\n}\n\n// Bintray\nProperties properties = new Properties()\nproperties.load(project.rootProject.file('local.properties').newDataInputStream())\n\nbintray {\n    user = properties.getProperty(\"bintray.user\")\n    key = properties.getProperty(\"bintray.apikey\")\n\n    configurations = ['archives']\n    pkg {\n        repo = bintrayRepo\n        name = bintrayName\n        desc = libraryDescription\n        userOrg = orgName\n        websiteUrl = siteUrl\n        vcsUrl = gitUrl\n        licenses = ['Apache-2.0']\n        publish = true\n        publicDownloadNumbers = true\n        version {\n            desc = libraryDescription\n            gpg {\n                sign = true //Determines whether to GPG sign the files. The default is false\n                passphrase = properties.getProperty(\"bintray.gpg.password\")\n                //Optional. The passphrase for GPG signing'\n            }\n        }\n    }\n}\n\n//from https://github.com/workarounds/bundler/blob/master/gradle/bintray-java-v1.gradle"
  },
  {
    "path": "gradle/install-v1.gradle",
    "content": "apply plugin: 'com.github.dcendents.android-maven'\n\ngroup = publishedGroupId                               // Maven Group ID for the artifact\n\ninstall {\n    repositories.mavenInstaller {\n        // This generates POM.xml with proper parameters\n        pom {\n            project {\n                packaging 'aar'\n                groupId publishedGroupId\n                artifactId artifact\n\n                // Add your description here\n                name libraryName\n                description libraryDescription\n                url siteUrl\n\n                // Set your license\n                licenses {\n                    license {\n                        name licenseName\n                        url licenseUrl\n                    }\n                }\n                developers {\n                    developer {\n                        id developerId\n                        name developerName\n                        email developerEmail\n                    }\n                }\n                scm {\n                    connection gitUrl\n                    developerConnection gitUrl\n                    url siteUrl\n\n                }\n            }\n        }\n    }\n}\n\n//from https://github.com/workarounds/bundler/blob/master/gradle/install-v1.gradle"
  },
  {
    "path": "gradle/wrapper/gradle-wrapper.properties",
    "content": "#Mon Dec 28 10:00:20 PST 2015\ndistributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\nzipStoreBase=GRADLE_USER_HOME\nzipStorePath=wrapper/dists\ndistributionUrl=https\\://services.gradle.org/distributions/gradle-2.10-all.zip\n"
  },
  {
    "path": "gradle.properties",
    "content": "# Project-wide Gradle settings.\n\n# IDE (e.g. Android Studio) users:\n# Gradle settings configured through the IDE *will override*\n# any settings specified in this file.\n\n# For more details on how to configure your build environment visit\n# http://www.gradle.org/docs/current/userguide/build_environment.html\n\n# Specifies the JVM arguments used for the daemon process.\n# The setting is particularly useful for tweaking memory settings.\n# Default value: -Xmx10248m -XX:MaxPermSize=256m\n# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8\n\n# When configured, Gradle will run in incubating parallel mode.\n# This option should only be used with decoupled projects. More details, visit\n# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects\n# org.gradle.parallel=true"
  },
  {
    "path": "gradlew",
    "content": "#!/usr/bin/env bash\n\n##############################################################################\n##\n##  Gradle start up script for UN*X\n##\n##############################################################################\n\n# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nDEFAULT_JVM_OPTS=\"\"\n\nAPP_NAME=\"Gradle\"\nAPP_BASE_NAME=`basename \"$0\"`\n\n# Use the maximum available, or set MAX_FD != -1 to use that value.\nMAX_FD=\"maximum\"\n\nwarn ( ) {\n    echo \"$*\"\n}\n\ndie ( ) {\n    echo\n    echo \"$*\"\n    echo\n    exit 1\n}\n\n# OS specific support (must be 'true' or 'false').\ncygwin=false\nmsys=false\ndarwin=false\ncase \"`uname`\" in\n  CYGWIN* )\n    cygwin=true\n    ;;\n  Darwin* )\n    darwin=true\n    ;;\n  MINGW* )\n    msys=true\n    ;;\nesac\n\n# Attempt to set APP_HOME\n# Resolve links: $0 may be a link\nPRG=\"$0\"\n# Need this for relative symlinks.\nwhile [ -h \"$PRG\" ] ; do\n    ls=`ls -ld \"$PRG\"`\n    link=`expr \"$ls\" : '.*-> \\(.*\\)$'`\n    if expr \"$link\" : '/.*' > /dev/null; then\n        PRG=\"$link\"\n    else\n        PRG=`dirname \"$PRG\"`\"/$link\"\n    fi\ndone\nSAVED=\"`pwd`\"\ncd \"`dirname \\\"$PRG\\\"`/\" >/dev/null\nAPP_HOME=\"`pwd -P`\"\ncd \"$SAVED\" >/dev/null\n\nCLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar\n\n# Determine the Java command to use to start the JVM.\nif [ -n \"$JAVA_HOME\" ] ; then\n    if [ -x \"$JAVA_HOME/jre/sh/java\" ] ; then\n        # IBM's JDK on AIX uses strange locations for the executables\n        JAVACMD=\"$JAVA_HOME/jre/sh/java\"\n    else\n        JAVACMD=\"$JAVA_HOME/bin/java\"\n    fi\n    if [ ! -x \"$JAVACMD\" ] ; then\n        die \"ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\n    fi\nelse\n    JAVACMD=\"java\"\n    which java >/dev/null 2>&1 || die \"ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\nfi\n\n# Increase the maximum file descriptors if we can.\nif [ \"$cygwin\" = \"false\" -a \"$darwin\" = \"false\" ] ; then\n    MAX_FD_LIMIT=`ulimit -H -n`\n    if [ $? -eq 0 ] ; then\n        if [ \"$MAX_FD\" = \"maximum\" -o \"$MAX_FD\" = \"max\" ] ; then\n            MAX_FD=\"$MAX_FD_LIMIT\"\n        fi\n        ulimit -n $MAX_FD\n        if [ $? -ne 0 ] ; then\n            warn \"Could not set maximum file descriptor limit: $MAX_FD\"\n        fi\n    else\n        warn \"Could not query maximum file descriptor limit: $MAX_FD_LIMIT\"\n    fi\nfi\n\n# For Darwin, add options to specify how the application appears in the dock\nif $darwin; then\n    GRADLE_OPTS=\"$GRADLE_OPTS \\\"-Xdock:name=$APP_NAME\\\" \\\"-Xdock:icon=$APP_HOME/media/gradle.icns\\\"\"\nfi\n\n# For Cygwin, switch paths to Windows format before running java\nif $cygwin ; then\n    APP_HOME=`cygpath --path --mixed \"$APP_HOME\"`\n    CLASSPATH=`cygpath --path --mixed \"$CLASSPATH\"`\n    JAVACMD=`cygpath --unix \"$JAVACMD\"`\n\n    # We build the pattern for arguments to be converted via cygpath\n    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`\n    SEP=\"\"\n    for dir in $ROOTDIRSRAW ; do\n        ROOTDIRS=\"$ROOTDIRS$SEP$dir\"\n        SEP=\"|\"\n    done\n    OURCYGPATTERN=\"(^($ROOTDIRS))\"\n    # Add a user-defined pattern to the cygpath arguments\n    if [ \"$GRADLE_CYGPATTERN\" != \"\" ] ; then\n        OURCYGPATTERN=\"$OURCYGPATTERN|($GRADLE_CYGPATTERN)\"\n    fi\n    # Now convert the arguments - kludge to limit ourselves to /bin/sh\n    i=0\n    for arg in \"$@\" ; do\n        CHECK=`echo \"$arg\"|egrep -c \"$OURCYGPATTERN\" -`\n        CHECK2=`echo \"$arg\"|egrep -c \"^-\"`                                 ### Determine if an option\n\n        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition\n            eval `echo args$i`=`cygpath --path --ignore --mixed \"$arg\"`\n        else\n            eval `echo args$i`=\"\\\"$arg\\\"\"\n        fi\n        i=$((i+1))\n    done\n    case $i in\n        (0) set -- ;;\n        (1) set -- \"$args0\" ;;\n        (2) set -- \"$args0\" \"$args1\" ;;\n        (3) set -- \"$args0\" \"$args1\" \"$args2\" ;;\n        (4) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" ;;\n        (5) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" ;;\n        (6) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" ;;\n        (7) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" ;;\n        (8) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" ;;\n        (9) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" \"$args8\" ;;\n    esac\nfi\n\n# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules\nfunction splitJvmOpts() {\n    JVM_OPTS=(\"$@\")\n}\neval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS\nJVM_OPTS[${#JVM_OPTS[*]}]=\"-Dorg.gradle.appname=$APP_BASE_NAME\"\n\nexec \"$JAVACMD\" \"${JVM_OPTS[@]}\" -classpath \"$CLASSPATH\" org.gradle.wrapper.GradleWrapperMain \"$@\"\n"
  },
  {
    "path": "gradlew.bat",
    "content": "@if \"%DEBUG%\" == \"\" @echo off\r\n@rem ##########################################################################\r\n@rem\r\n@rem  Gradle startup script for Windows\r\n@rem\r\n@rem ##########################################################################\r\n\r\n@rem Set local scope for the variables with windows NT shell\r\nif \"%OS%\"==\"Windows_NT\" setlocal\r\n\r\n@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\r\nset DEFAULT_JVM_OPTS=\r\n\r\nset DIRNAME=%~dp0\r\nif \"%DIRNAME%\" == \"\" set DIRNAME=.\r\nset APP_BASE_NAME=%~n0\r\nset APP_HOME=%DIRNAME%\r\n\r\n@rem Find java.exe\r\nif defined JAVA_HOME goto findJavaFromJavaHome\r\n\r\nset JAVA_EXE=java.exe\r\n%JAVA_EXE% -version >NUL 2>&1\r\nif \"%ERRORLEVEL%\" == \"0\" goto init\r\n\r\necho.\r\necho ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\r\necho.\r\necho Please set the JAVA_HOME variable in your environment to match the\r\necho location of your Java installation.\r\n\r\ngoto fail\r\n\r\n:findJavaFromJavaHome\r\nset JAVA_HOME=%JAVA_HOME:\"=%\r\nset JAVA_EXE=%JAVA_HOME%/bin/java.exe\r\n\r\nif exist \"%JAVA_EXE%\" goto init\r\n\r\necho.\r\necho ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%\r\necho.\r\necho Please set the JAVA_HOME variable in your environment to match the\r\necho location of your Java installation.\r\n\r\ngoto fail\r\n\r\n:init\r\n@rem Get command-line arguments, handling Windowz variants\r\n\r\nif not \"%OS%\" == \"Windows_NT\" goto win9xME_args\r\nif \"%@eval[2+2]\" == \"4\" goto 4NT_args\r\n\r\n:win9xME_args\r\n@rem Slurp the command line arguments.\r\nset CMD_LINE_ARGS=\r\nset _SKIP=2\r\n\r\n:win9xME_args_slurp\r\nif \"x%~1\" == \"x\" goto execute\r\n\r\nset CMD_LINE_ARGS=%*\r\ngoto execute\r\n\r\n:4NT_args\r\n@rem Get arguments from the 4NT Shell from JP Software\r\nset CMD_LINE_ARGS=%$\r\n\r\n:execute\r\n@rem Setup the command line\r\n\r\nset CLASSPATH=%APP_HOME%\\gradle\\wrapper\\gradle-wrapper.jar\r\n\r\n@rem Execute Gradle\r\n\"%JAVA_EXE%\" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% \"-Dorg.gradle.appname=%APP_BASE_NAME%\" -classpath \"%CLASSPATH%\" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%\r\n\r\n:end\r\n@rem End local scope for the variables with windows NT shell\r\nif \"%ERRORLEVEL%\"==\"0\" goto mainEnd\r\n\r\n:fail\r\nrem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of\r\nrem the _cmd.exe /c_ return code!\r\nif  not \"\" == \"%GRADLE_EXIT_CONSOLE%\" exit 1\r\nexit /b 1\r\n\r\n:mainEnd\r\nif \"%OS%\"==\"Windows_NT\" endlocal\r\n\r\n:omega\r\n"
  },
  {
    "path": "settings.gradle",
    "content": "include ':app', ':androidunittest'\n"
  }
]