From af7d9f3b113846b4b0c3615048cbb3a7c7d3940b Mon Sep 17 00:00:00 2001
From: s091424 <ihatehomework2014@gmail.com>
Date: Sun, 22 Dec 2019 22:20:44 +0800
Subject: [PATCH 1/5] Added sample app unit tests

---
 .../org/aerogear/offix/ExampleUnitTest.java   |  6 ++-
 .../graphqlandroid/ExampleInstrumentedTest.kt |  2 +
 .../graphqlandroid/ExampleUnitTest.kt         | 48 +++++++++++++++++++
 3 files changed, 55 insertions(+), 1 deletion(-)

diff --git a/offix/src/test/java/org/aerogear/offix/ExampleUnitTest.java b/offix/src/test/java/org/aerogear/offix/ExampleUnitTest.java
index 215e23c..0ef40af 100644
--- a/offix/src/test/java/org/aerogear/offix/ExampleUnitTest.java
+++ b/offix/src/test/java/org/aerogear/offix/ExampleUnitTest.java
@@ -10,8 +10,12 @@
  * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
  */
 public class ExampleUnitTest {
+
     @Test
     public void addition_isCorrect() {
         assertEquals(4, 2 + 2);
     }
-}
\ No newline at end of file
+
+
+
+}
diff --git a/sample/src/androidTest/java/org/aerogear/graphqlandroid/ExampleInstrumentedTest.kt b/sample/src/androidTest/java/org/aerogear/graphqlandroid/ExampleInstrumentedTest.kt
index f48c14d..1e23995 100644
--- a/sample/src/androidTest/java/org/aerogear/graphqlandroid/ExampleInstrumentedTest.kt
+++ b/sample/src/androidTest/java/org/aerogear/graphqlandroid/ExampleInstrumentedTest.kt
@@ -15,10 +15,12 @@ import org.junit.Assert.*
  */
 @RunWith(AndroidJUnit4::class)
 class ExampleInstrumentedTest {
+
     @Test
     fun useAppContext() {
         // Context of the app under test.
         val appContext = InstrumentationRegistry.getTargetContext()
         assertEquals("com.lavanya.graphqlandroid", appContext.packageName)
     }
+
 }
diff --git a/sample/src/test/java/org/aerogear/graphqlandroid/ExampleUnitTest.kt b/sample/src/test/java/org/aerogear/graphqlandroid/ExampleUnitTest.kt
index 12ff30b..82b43c4 100644
--- a/sample/src/test/java/org/aerogear/graphqlandroid/ExampleUnitTest.kt
+++ b/sample/src/test/java/org/aerogear/graphqlandroid/ExampleUnitTest.kt
@@ -1,5 +1,9 @@
 package org.aerogear.graphqlandroid
 
+import com.apollographql.apollo.api.OperationName
+import org.aerogear.graphqlandroid.model.NamePair
+import org.aerogear.graphqlandroid.model.UserOutput
+import org.aerogear.graphqlandroid.type.TaskInput
 import org.junit.Test
 
 import org.junit.Assert.*
@@ -10,8 +14,52 @@ import org.junit.Assert.*
  * See [testing documentation](http://d.android.com/tools/testing).
  */
 class ExampleUnitTest {
+
     @Test
     fun addition_isCorrect() {
         assertEquals(4, 2 + 2)
     }
+
+    @Test
+    fun baseURLEquals(){
+        assertEquals("http://10.0.2.2:4000/graphql", Utils.BASE_URL)
+    }
+
+    @Test
+    fun namePairCorrect(){
+        val pair = NamePair("bagger", "Tea")
+        assertEquals("bagger", pair.fName)
+        assertEquals("Tea", pair.lName)
+    }
+
+    @Test
+    fun userOutputCorrect(){
+        val output = UserOutput(
+            "Test",
+            "By the order of explosive potato",
+            0,
+            "bagger",
+            "Tea",
+            "Teabagger12345",
+            "explosivepotatoexploded@gmail.com"
+        )
+        with(output) {
+            assertEquals("Test", title)
+            assertEquals("By the order of explosive potato", desc)
+            assertEquals(0, id)
+            assertEquals("bagger", firstName)
+            assertEquals("Tea", lastName)
+            assertEquals("Teabagger12345", userId)
+            assertEquals("explosivepotatoexploded@gmail.com", email)
+        }
+    }
+
+    @Test
+    fun operationNameTest(){
+        assertTrue(OperationName { "Teabagger" }.name().equals("Teabagger"))
+        assertFalse(OperationName { "Teabagger" }.name().equals("Potato"))
+
+        assertFalse(OperationName { "Teabagger" }.name().isBlank())
+    }
+
 }

From 427679120f91b6a722907b557a2e26d631b6cc7f Mon Sep 17 00:00:00 2001
From: s091424 <ihatehomework2014@gmail.com>
Date: Thu, 26 Dec 2019 16:15:33 +0800
Subject: [PATCH 2/5] implement Codecov

---
 README.md                                         |  2 ++
 offix/build.gradle                                | 15 +++++++++++++++
 .../aerogear/graphqlandroid/ExampleUnitTest.kt    |  1 -
 3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 52259b2..c847f80 100644
--- a/README.md
+++ b/README.md
@@ -3,6 +3,8 @@
   <br/>
   Offix extends capabilities of Apollo GraphQL providing</br>
   fully featured Offline Workflow and Conflict Resolution for Android Platform
+  
+  [![codecov](https://codecov.io/gh/s091424/offix-android/branch/master/graph/badge.svg)](https://codecov.io/gh/s091424/offix-android)
 </p>
 
 
diff --git a/offix/build.gradle b/offix/build.gradle
index 57776c0..d5b4439 100644
--- a/offix/build.gradle
+++ b/offix/build.gradle
@@ -4,6 +4,8 @@ apply plugin: 'kotlin-android'
 apply plugin: 'kotlin-kapt'
 apply plugin: 'kotlin-android-extensions'
 
+apply plugin: 'jacoco-android'
+
 buildscript {
     repositories {
         jcenter()
@@ -11,6 +13,7 @@ buildscript {
     dependencies {
         classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
         classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
+        classpath 'com.dicedmelon.gradle:jacoco-android:0.1.4'
     }
 }
 
@@ -18,6 +21,14 @@ task cleanBuildPublish(type: GradleBuild) {
     tasks = ['clean', 'build', 'bintrayUpload' , 'sourcesJar' ,'javadocJar' , 'javadoc']
 }
 
+tasks.withType(Test) {
+    jacoco.includeNoLocationClasses = true
+}
+
+jacoco {
+    toolVersion = "0.8.4"
+}
+
 android {
     compileSdkVersion 28
 
@@ -35,7 +46,11 @@ android {
             minifyEnabled false
             proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
         }
+        debug {
+            testCoverageEnabled true
+        }
     }
+
 }
 
 dependencies {
diff --git a/sample/src/test/java/org/aerogear/graphqlandroid/ExampleUnitTest.kt b/sample/src/test/java/org/aerogear/graphqlandroid/ExampleUnitTest.kt
index 82b43c4..704aedf 100644
--- a/sample/src/test/java/org/aerogear/graphqlandroid/ExampleUnitTest.kt
+++ b/sample/src/test/java/org/aerogear/graphqlandroid/ExampleUnitTest.kt
@@ -3,7 +3,6 @@ package org.aerogear.graphqlandroid
 import com.apollographql.apollo.api.OperationName
 import org.aerogear.graphqlandroid.model.NamePair
 import org.aerogear.graphqlandroid.model.UserOutput
-import org.aerogear.graphqlandroid.type.TaskInput
 import org.junit.Test
 
 import org.junit.Assert.*

From cb3d2451a0820ee3bdc48b16caa00489d5486a9a Mon Sep 17 00:00:00 2001
From: s091424 <ihatehomework2014@gmail.com>
Date: Thu, 26 Dec 2019 16:25:28 +0800
Subject: [PATCH 3/5] Implement Travis

---
 .travis.yml | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 .travis.yml

diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..f7819d3
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,49 @@
+language: android
+sudo: required
+jdk: oraclejdk8
+env:
+  global:
+    - ANDROID_TARGET=android-28
+    - ANDROID_ABI=armeabi-v7a
+    - CODECOV_TOKEN=02acc17d-8043-4416-96f9-d8fcb499a48c
+android:
+  components:
+    - tools
+    - platform-tools
+    - build-tools-28.0.0
+    - android-28
+    - extra-google-google_play_services
+    - extra-google-m2repository
+    - extra-android-m2repository
+    - $ANDROID_TARGET
+    - sys-img-${ANDROID_ABI}-${ANDROID_TARGET}
+
+licenses:
+  - 'android-sdk-license-.+'
+
+before_install:
+  - yes | sdkmanager "platforms;android-28"
+  - chmod +x ./gradlew
+  - mkdir "$ANDROID_HOME/licenses" || true
+  - echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license"
+  - echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license"
+  - yes | sdkmanager --update
+  - yes | sdkmanager --licenses
+
+script:
+  - echo "Hello! This is Travis"
+  - ./gradlew build jacocoTestReport
+
+after_success:
+  - bash <(curl -s https://codecov.io/bash) -t ${CODECOV_TOKEN}
+
+
+before_cache:
+  - rm -f  $HOME/.gradle/caches/modules-2/modules-2.lock
+  - rm -fr $HOME/.gradle/caches/*/plugin-resolution/
+
+cache:
+  directories:
+    - $HOME/.gradle/caches/
+    - $HOME/.gradle/wrapper/
+    - $HOME/.android/build-cache
\ No newline at end of file

From 71b4a14141d4c33bf0bca67093bc88f4150a0610 Mon Sep 17 00:00:00 2001
From: s091424 <ihatehomework2014@gmail.com>
Date: Thu, 26 Dec 2019 16:33:36 +0800
Subject: [PATCH 4/5] Travis Readme

---
 README.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/README.md b/README.md
index c847f80..6524920 100644
--- a/README.md
+++ b/README.md
@@ -5,6 +5,7 @@
   fully featured Offline Workflow and Conflict Resolution for Android Platform
   
   [![codecov](https://codecov.io/gh/s091424/offix-android/branch/master/graph/badge.svg)](https://codecov.io/gh/s091424/offix-android)
+  [![travis](https://api.travis-ci.com/s091424/offix-android.svg?branch=master)
 </p>
 
 

From 3173d4ebd5a2064a1fff6f2df071ee0f1de12373 Mon Sep 17 00:00:00 2001
From: s091424 <ihatehomework2014@gmail.com>
Date: Thu, 26 Dec 2019 16:35:36 +0800
Subject: [PATCH 5/5] Travis Readme Edit

---
 README.md | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/README.md b/README.md
index 6524920..ddb21bc 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,5 @@
 <p align="center">
+
   <img width="400" src="https://github.com/aerogear/offix/raw/master/resources/logo.png">
   <br/>
   Offix extends capabilities of Apollo GraphQL providing</br>
@@ -6,6 +7,7 @@
   
   [![codecov](https://codecov.io/gh/s091424/offix-android/branch/master/graph/badge.svg)](https://codecov.io/gh/s091424/offix-android)
   [![travis](https://api.travis-ci.com/s091424/offix-android.svg?branch=master)
+  
 </p>
 
 
