2 * Copyright (C) 2010 ZXing authors
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 * These authors would like to acknowledge the Spanish Ministry of Industry,
19 * Tourism and Trade, for the support in the project TSI020301-2008-2
20 * "PIRAmIDE: Personalizable Interactions with Resources on AmI-enabled
21 * Mobile Dynamic Environments", led by Treelogic
22 * ( http://www.treelogic.com/ ):
24 * http://www.piramidepse.com/
27 package com.google.zxing.client.result;
29 import java.util.Hashtable;
31 import junit.framework.TestCase;
33 import com.google.zxing.BarcodeFormat;
34 import com.google.zxing.Result;
37 * @author Antonio Manuel Benjumea Conde, Servinform, S.A.
38 * @author AgustÃn Delgado, Servinform, S.A.
40 public final class ExpandedProductParsedResultTestCase extends TestCase {
42 public void test_RSSExpanded() {
43 String text = "(01)66546(13)001205(3932)4455(3102)6544(123)544654";
44 String productID = "66546";
46 String lotNumber = "-";
47 String productionDate = "-";
48 String packagingDate = "001205";
49 String bestBeforeDate = "-";
50 String expirationDate = "-";
51 String weight = "6544";
52 String weightType = "KG";
53 String weightIncrement = "2";
55 String priceIncrement = "2";
56 String priceCurrency = "445";
57 Hashtable uncommonAIs = new Hashtable();
58 uncommonAIs.put("123", "544654");
60 Result result = new Result(text, null, null, BarcodeFormat.RSS_EXPANDED);
61 ExpandedProductParsedResult o = ExpandedProductResultParser
63 assertEquals(productID, o.getProductID());
64 assertEquals(sscc, o.getSscc());
65 assertEquals(lotNumber, o.getLotNumber());
66 assertEquals(productionDate, o.getProductionDate());
67 assertEquals(packagingDate, o.getPackagingDate());
68 assertEquals(bestBeforeDate, o.getBestBeforeDate());
69 assertEquals(expirationDate, o.getExpirationDate());
70 assertEquals(weight, o.getWeight());
71 assertEquals(weightType, o.getWeightType());
72 assertEquals(weightIncrement, o.getWeightIncrement());
73 assertEquals(price, o.getPrice());
74 assertEquals(priceIncrement, o.getPriceIncrement());
75 assertEquals(priceCurrency, o.getPriceCurrency());
76 assertEquals(uncommonAIs, o.getUncommonAIs());