Skip to content
This repository was archived by the owner on Mar 24, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions offix/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ task cleanBuildPublish(type: GradleBuild) {
}

android {

testOptions {
unitTests.returnDefaultValues = true
}

compileSdkVersion 28

defaultConfig {
Expand All @@ -39,6 +44,9 @@ android {
}

dependencies {

testImplementation 'org.json:json:20140107'

implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
Expand Down
17 changes: 0 additions & 17 deletions offix/src/test/java/org/aerogear/offix/ExampleUnitTest.java

This file was deleted.

47 changes: 47 additions & 0 deletions offix/src/test/java/org/aerogear/offix/ExampleUnitTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package org.aerogear.offix

import org.junit.Assert
import org.junit.Test

import com.apollographql.apollo.api.OperationName
import org.json.JSONObject

import org.aerogear.offix.persistence.Converters
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
class ExampleUnitTest {

// Dummy Test
@Test
fun addition_isCorrect() {
Assert.assertEquals(4, 2 + 2)
}

// Check String To Json
@Test
fun CheckStringToJson(){
val testJson:JSONObject = Converters().StringToJson("{'name': 'testName'}")
Assert.assertEquals("testName",testJson["name"])
}

// Check String to Operation Name
@Test
fun CheckStringToOperName(){
val testOperation:OperationName = Converters().StringToOperName("Test")
Assert.assertEquals("Test",testOperation.name())
}

// Check Operation to String
@Test
fun CheckOperationToString(){
val testOperation = OperationName { "Test Operation" }
val testString:String = Converters().OperationNameToString(testOperation)

Assert.assertEquals("Test Operation",testString)
}


}