11package io .snabble .sdk ;
22
3- import androidx .test .annotation .UiThreadTest ;
4- import androidx .test .filters .LargeTest ;
5- import androidx .test .runner .AndroidJUnit4 ;
6-
73import org .apache .commons .io .IOUtils ;
84import org .apache .commons .lang3 .StringUtils ;
95import org .junit .Assert ;
106import org .junit .Test ;
117import org .junit .runner .RunWith ;
8+ import org .robolectric .RobolectricTestRunner ;
129
1310import java .io .IOException ;
1411import java .util .ArrayList ;
1916import io .snabble .sdk .encodedcodes .EncodedCodesGenerator ;
2017import io .snabble .sdk .encodedcodes .EncodedCodesOptions ;
2118
22- @ RunWith (AndroidJUnit4 .class )
23- @ LargeTest
19+ @ RunWith (RobolectricTestRunner .class )
2420public class EncodedCodesGeneratorTest extends SnabbleSdkTest {
2521 @ Test
26- @ UiThreadTest
2722 public void testGeneration () {
2823 EncodedCodesOptions options = new EncodedCodesOptions .Builder (project )
2924 .prefix ("+" )
@@ -43,7 +38,6 @@ public void testGeneration() {
4338 }
4439
4540 @ Test
46- @ UiThreadTest
4741 public void testSplitAtMaxChars () {
4842 EncodedCodesOptions options = new EncodedCodesOptions .Builder (project )
4943 .prefix ("+" )
@@ -66,7 +60,6 @@ public void testSplitAtMaxChars() {
6660 }
6761
6862 @ Test
69- @ UiThreadTest
7063 public void testSplitAtMaxCodes () {
7164 EncodedCodesOptions options = new EncodedCodesOptions .Builder (project )
7265 .prefix ("+" )
@@ -89,7 +82,6 @@ public void testSplitAtMaxCodes() {
8982 }
9083
9184 @ Test
92- @ UiThreadTest
9385 public void testSplitAgeRestrictedProducts () {
9486 EncodedCodesOptions options = new EncodedCodesOptions .Builder (project )
9587 .prefix ("+" )
@@ -117,7 +109,6 @@ public void testSplitAgeRestrictedProducts() {
117109 }
118110
119111 @ Test
120- @ UiThreadTest
121112 public void testSplitAgeRestrictedProductsInMultipleCodes () {
122113 EncodedCodesOptions options = new EncodedCodesOptions .Builder (project )
123114 .prefix ("+" )
@@ -146,7 +137,6 @@ public void testSplitAgeRestrictedProductsInMultipleCodes() {
146137 }
147138
148139 @ Test
149- @ UiThreadTest
150140 public void testSplitAgeRestrictedProductsInMultipleCodes2 () {
151141 EncodedCodesOptions options = new EncodedCodesOptions .Builder (project )
152142 .prefix ("+" )
@@ -178,7 +168,6 @@ public void testSplitAgeRestrictedProductsInMultipleCodes2() {
178168 }
179169
180170 @ Test
181- @ UiThreadTest
182171 public void testSplitWithOnlyOneRestrictedProduct () {
183172 EncodedCodesOptions options = new EncodedCodesOptions .Builder (project )
184173 .prefix ("+" )
@@ -204,7 +193,6 @@ public void testSplitWithOnlyOneRestrictedProduct() {
204193 }
205194
206195 @ Test
207- @ UiThreadTest
208196 public void testKnauber () {
209197 EncodedCodesOptions options = new EncodedCodesOptions .Builder (project )
210198 .prefix ("" )
@@ -234,7 +222,6 @@ public void testKnauber() {
234222 }
235223
236224 @ Test
237- @ UiThreadTest
238225 public void testCoupons () {
239226 EncodedCodesOptions options = new EncodedCodesOptions .Builder (project )
240227 .prefix ("" )
@@ -263,7 +250,6 @@ public void testCoupons() {
263250 }
264251
265252 @ Test
266- @ UiThreadTest
267253 public void testEdeka () {
268254 EncodedCodesOptions options = new EncodedCodesOptions .Builder (project )
269255 .prefix ("XE" )
@@ -288,7 +274,6 @@ public void testEdeka() {
288274 }
289275
290276 @ Test
291- @ UiThreadTest
292277 public void testEdekaWithOverflow () {
293278 EncodedCodesOptions options = new EncodedCodesOptions .Builder (project )
294279 .prefix ("XE" )
@@ -314,7 +299,6 @@ public void testEdekaWithOverflow() {
314299 }
315300
316301 @ Test
317- @ UiThreadTest
318302 public void testEdekaWithRestrictedProduct () {
319303 EncodedCodesOptions options = new EncodedCodesOptions .Builder (project )
320304 .prefix ("XE" )
@@ -343,7 +327,6 @@ public void testEdekaWithRestrictedProduct() {
343327 }
344328
345329 @ Test
346- @ UiThreadTest
347330 public void testExpensiveItemsSortedToBottom () {
348331 EncodedCodesOptions options = new EncodedCodesOptions .Builder (project )
349332 .prefix ("" )
@@ -367,7 +350,6 @@ public void testExpensiveItemsSortedToBottom() {
367350 }
368351
369352 @ Test
370- @ UiThreadTest
371353 public void testCSVFormat () {
372354 EncodedCodesOptions options = new EncodedCodesOptions .Builder (project )
373355 .prefix ("snabble;\n " )
@@ -394,7 +376,6 @@ public void testCSVFormat() {
394376 }
395377
396378 @ Test
397- @ UiThreadTest
398379 public void testCSVv2Format () {
399380 EncodedCodesOptions options = new EncodedCodesOptions .Builder (project )
400381 .prefix ("snabble;{qrCodeIndex};{qrCodeCount}\n " )
@@ -422,9 +403,8 @@ public void testCSVv2Format() {
422403 }
423404
424405 @ Test
425- @ UiThreadTest
426406 public void testTransmissionTemplates () throws IOException , Snabble .SnabbleException {
427- String [] sql = IOUtils . readLines ( context . getAssets (). open ( "transmission_template.sql" )). toArray ( new String [ 0 ] );
407+ String [] sql = loadSql ( "transmission_template" ). split ( " \n " );
428408 withDb ("test_1_25.sqlite3" , false , sql );
429409
430410 EncodedCodesOptions options = new EncodedCodesOptions .Builder (project )
0 commit comments