Skip to content
Merged
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
6 changes: 2 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
- name: Set up JDK 12
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Grant execute permission for gradlew
run: chmod +x gradlew
java-version: 12
- name: Build
run: ./gradlew build
6 changes: 2 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
- name: Set up JDK 12
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Grant execute permission for gradlew
run: chmod +x gradlew
java-version: 12
- name: Build
run: ./gradlew build
- name: Publish to Maven Repository
Expand Down
12 changes: 10 additions & 2 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,20 @@ android {
freeCompilerArgs = ["-Xjvm-default=all"]
jvmTarget = "1.8"
}

testOptions {
unitTests {
includeAndroidResources = true
}
}
}

dependencies {
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:${project.desugarVersion}"

implementation project(':utils')

implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'commons-io:commons-io:2.5'
implementation 'org.apache.commons:commons-lang3:3.8.1'
implementation 'org.iban4j:iban4j:3.2.1'
Expand All @@ -58,7 +64,9 @@ dependencies {
api "com.squareup.okhttp3:okhttp:${project.okhttpVersion}"
api 'com.google.code.gson:gson:2.8.6'

testImplementation 'junit:junit:4.13'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.robolectric:robolectric:4.5.1'
testImplementation "com.squareup.okhttp3:mockwebserver:${project.okhttpVersion}"

androidTestImplementation 'androidx.test:rules:1.3.0'
androidTestImplementation 'androidx.test:runner:1.3.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@

import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;

import java.math.BigDecimal;

import io.snabble.sdk.codes.ScannedCode;
import io.snabble.sdk.codes.templates.CodeTemplate;

@RunWith(RobolectricTestRunner.class)
public class CodeTemplateTest {
@Test
public void testTemplateParser() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
package io.snabble.sdk;

import androidx.test.annotation.UiThreadTest;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;

import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;

import java.io.IOException;
import java.util.ArrayList;
Expand All @@ -19,11 +16,9 @@
import io.snabble.sdk.encodedcodes.EncodedCodesGenerator;
import io.snabble.sdk.encodedcodes.EncodedCodesOptions;

@RunWith(AndroidJUnit4.class)
@LargeTest
@RunWith(RobolectricTestRunner.class)
public class EncodedCodesGeneratorTest extends SnabbleSdkTest {
@Test
@UiThreadTest
public void testGeneration() {
EncodedCodesOptions options = new EncodedCodesOptions.Builder(project)
.prefix("+")
Expand All @@ -43,7 +38,6 @@ public void testGeneration() {
}

@Test
@UiThreadTest
public void testSplitAtMaxChars() {
EncodedCodesOptions options = new EncodedCodesOptions.Builder(project)
.prefix("+")
Expand All @@ -66,7 +60,6 @@ public void testSplitAtMaxChars() {
}

@Test
@UiThreadTest
public void testSplitAtMaxCodes() {
EncodedCodesOptions options = new EncodedCodesOptions.Builder(project)
.prefix("+")
Expand All @@ -89,7 +82,6 @@ public void testSplitAtMaxCodes() {
}

@Test
@UiThreadTest
public void testSplitAgeRestrictedProducts() {
EncodedCodesOptions options = new EncodedCodesOptions.Builder(project)
.prefix("+")
Expand Down Expand Up @@ -117,7 +109,6 @@ public void testSplitAgeRestrictedProducts() {
}

@Test
@UiThreadTest
public void testSplitAgeRestrictedProductsInMultipleCodes() {
EncodedCodesOptions options = new EncodedCodesOptions.Builder(project)
.prefix("+")
Expand Down Expand Up @@ -146,7 +137,6 @@ public void testSplitAgeRestrictedProductsInMultipleCodes() {
}

@Test
@UiThreadTest
public void testSplitAgeRestrictedProductsInMultipleCodes2() {
EncodedCodesOptions options = new EncodedCodesOptions.Builder(project)
.prefix("+")
Expand Down Expand Up @@ -178,7 +168,6 @@ public void testSplitAgeRestrictedProductsInMultipleCodes2() {
}

@Test
@UiThreadTest
public void testSplitWithOnlyOneRestrictedProduct() {
EncodedCodesOptions options = new EncodedCodesOptions.Builder(project)
.prefix("+")
Expand All @@ -204,7 +193,6 @@ public void testSplitWithOnlyOneRestrictedProduct() {
}

@Test
@UiThreadTest
public void testKnauber() {
EncodedCodesOptions options = new EncodedCodesOptions.Builder(project)
.prefix("")
Expand Down Expand Up @@ -234,7 +222,6 @@ public void testKnauber() {
}

@Test
@UiThreadTest
public void testCoupons() {
EncodedCodesOptions options = new EncodedCodesOptions.Builder(project)
.prefix("")
Expand Down Expand Up @@ -263,7 +250,6 @@ public void testCoupons() {
}

@Test
@UiThreadTest
public void testEdeka() {
EncodedCodesOptions options = new EncodedCodesOptions.Builder(project)
.prefix("XE")
Expand All @@ -288,7 +274,6 @@ public void testEdeka() {
}

@Test
@UiThreadTest
public void testEdekaWithOverflow() {
EncodedCodesOptions options = new EncodedCodesOptions.Builder(project)
.prefix("XE")
Expand All @@ -314,7 +299,6 @@ public void testEdekaWithOverflow() {
}

@Test
@UiThreadTest
public void testEdekaWithRestrictedProduct() {
EncodedCodesOptions options = new EncodedCodesOptions.Builder(project)
.prefix("XE")
Expand Down Expand Up @@ -343,7 +327,6 @@ public void testEdekaWithRestrictedProduct() {
}

@Test
@UiThreadTest
public void testExpensiveItemsSortedToBottom() {
EncodedCodesOptions options = new EncodedCodesOptions.Builder(project)
.prefix("")
Expand All @@ -367,7 +350,6 @@ public void testExpensiveItemsSortedToBottom() {
}

@Test
@UiThreadTest
public void testCSVFormat() {
EncodedCodesOptions options = new EncodedCodesOptions.Builder(project)
.prefix("snabble;\n")
Expand All @@ -394,7 +376,6 @@ public void testCSVFormat() {
}

@Test
@UiThreadTest
public void testCSVv2Format() {
EncodedCodesOptions options = new EncodedCodesOptions.Builder(project)
.prefix("snabble;{qrCodeIndex};{qrCodeCount}\n")
Expand Down Expand Up @@ -422,9 +403,8 @@ public void testCSVv2Format() {
}

@Test
@UiThreadTest
public void testTransmissionTemplates() throws IOException, Snabble.SnabbleException {
String[] sql = IOUtils.readLines(context.getAssets().open("transmission_template.sql")).toArray(new String[0]);
String[] sql = loadSql("transmission_template").split("\n");
withDb("test_1_25.sqlite3", false, sql);

EncodedCodesOptions options = new EncodedCodesOptions.Builder(project)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
package io.snabble.sdk;

import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;

import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;

import java.io.IOException;

import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;

@RunWith(AndroidJUnit4.class)
@LargeTest
@RunWith(RobolectricTestRunner.class)
public class NetworkTest extends SnabbleSdkTest {
@Test
public void testLetsEncrypt() throws IOException {
Expand Down
Loading