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 com.google.zxing.BarcodeFormat;
32 import com.google.zxing.Result;
33 import org.junit.Assert;
34 import org.junit.Test;
37 * @author Antonio Manuel Benjumea Conde, Servinform, S.A.
38 * @author AgustÃn Delgado, Servinform, S.A.
40 public final class ExpandedProductParsedResultTestCase extends Assert {
43 public void test_RSSExpanded() {
44 String text = "(01)66546(13)001205(3932)4455(3102)6544(123)544654";
45 String productID = "66546";
47 String lotNumber = "-";
48 String productionDate = "-";
49 String packagingDate = "001205";
50 String bestBeforeDate = "-";
51 String expirationDate = "-";
52 String weight = "6544";
53 String weightType = "KG";
54 String weightIncrement = "2";
56 String priceIncrement = "2";
57 String priceCurrency = "445";
58 Hashtable uncommonAIs = new Hashtable();
59 uncommonAIs.put("123", "544654");
61 Result result = new Result(text, null, null, BarcodeFormat.RSS_EXPANDED);
62 ExpandedProductParsedResult o = ExpandedProductResultParser.parse(result);
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());