KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > openedit > store > ItemTest


1 /*
2  * Created on Sep 2, 2004
3  */

4 package com.openedit.store;
5
6
7 /**
8  * @author cburkey
9  *
10  */

11 public class ItemTest extends StoreTestCase
12 {
13
14     /**
15      * Constructor for ItemTest.
16      * @param arg0
17      */

18     public ItemTest(String JavaDoc arg0)
19     {
20         super(arg0);
21     }
22
23     public void testexactMatch()
24     {
25         InventoryItem item1 = new InventoryItem();
26         item1.setSize( "m" );
27         item1.setColor( "green" );
28         
29         assertEquals( 2, item1.getOptions().size());
30         
31         InventoryItem redItem = new InventoryItem();
32         redItem.setSize( "M" );
33         redItem.setColor( "Red" );
34         
35         InventoryItem greenItem = new InventoryItem();
36         greenItem.setSize( "M" );
37         greenItem.setColor( "green" );
38         
39         InventoryItem sameColorItem = new InventoryItem();
40         sameColorItem.setSize( "s" );
41         sameColorItem.setColor( "green" );
42         
43         InventoryItem anotherGreenItem = new InventoryItem();
44         anotherGreenItem.setSize("m");
45         anotherGreenItem.setColor("GREEN");
46         
47         
48         InventoryItem nullColorItem = new InventoryItem();
49         anotherGreenItem.setSize("m");
50         //anotherGreenItem.setColor("GREEN");
51

52         
53         InventoryItem nullItem = new InventoryItem();
54         
55 // assertFalse( nullItem.isExactMatch( item1 ) );
56
// assertFalse( redItem.isExactMatch( item1 ) );
57
// assertFalse( item1.isExactMatch( redItem ) );
58
// assertFalse( sameColorItem.isExactMatch( greenItem) );
59
// assertTrue( greenItem.isExactMatch(anotherGreenItem));
60
// assertFalse( nullColorItem.isExactMatch( greenItem) );
61
// assertFalse( greenItem.isExactMatch(nullColorItem) );
62
}
63
64 }
65
Popular Tags