mirror of
https://github.com/CatimaLoyalty/Android.git
synced 2026-04-03 15:22:11 -04:00
Add test for empty barcode type
This commit is contained in:
@@ -363,4 +363,26 @@ public class ImportExportTest
|
||||
assertEquals(false, result);
|
||||
assertEquals(0, db.getLoyaltyCardCount());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void importWithNoBarcodeType() throws IOException
|
||||
{
|
||||
String csvText = "";
|
||||
csvText += DBHelper.LoyaltyCardDbIds.ID + "," +
|
||||
DBHelper.LoyaltyCardDbIds.STORE + "," +
|
||||
DBHelper.LoyaltyCardDbIds.NOTE + "," +
|
||||
DBHelper.LoyaltyCardDbIds.CARD_ID + "," +
|
||||
DBHelper.LoyaltyCardDbIds.BARCODE_TYPE + "," +
|
||||
DBHelper.LoyaltyCardDbIds.HEADER_COLOR + "," +
|
||||
DBHelper.LoyaltyCardDbIds.HEADER_TEXT_COLOR + "\n";
|
||||
csvText += "1,store,note,12345,,1,1";
|
||||
|
||||
ByteArrayInputStream inputStream = new ByteArrayInputStream(csvText.getBytes(StandardCharsets.UTF_8));
|
||||
InputStreamReader inStream = new InputStreamReader(inputStream);
|
||||
|
||||
// Import the CSV data
|
||||
boolean result = MultiFormatImporter.importData(db, inStream, DataFormat.CSV);
|
||||
assertEquals(true, result);
|
||||
assertEquals(1, db.getLoyaltyCardCount());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user