3030import org .openmrs .module .stockmanagement .api .model .StockItem ;
3131
3232public class CashierItemPriceLineProcessorTest {
33-
33+
3434 private static final String PAYMENT_MODE_UUID = "pm-0000-0000-0000-000000000001" ;
35-
35+
3636 private static final String STOCK_ITEM_UUID = "si-0000-0000-0000-000000000001" ;
37-
37+
3838 private static final String BILLABLE_SERVICE_UUID = "bs-0000-0000-0000-000000000001" ;
39-
39+
4040 private static final String [] HEADERS = new String [] { "Uuid" , "name" , "price" , "payment mode" , "stock item" ,
4141 "billable service" };
42-
42+
4343 @ Mock
4444 private PaymentModeService paymentModeService ;
45-
45+
4646 @ Mock
4747 private StockManagementService stockManagementService ;
48-
48+
4949 @ Mock
5050 private BillableServiceService billableServiceService ;
51-
51+
5252 private CashierItemPriceLineProcessor processor ;
53-
53+
5454 private PaymentMode paymentMode ;
55-
55+
5656 @ Before
5757 public void setUp () {
5858 MockitoAnnotations .initMocks (this );
@@ -61,76 +61,76 @@ public void setUp() {
6161 paymentMode .setUuid (PAYMENT_MODE_UUID );
6262 when (paymentModeService .getPaymentModeByUuid (PAYMENT_MODE_UUID )).thenReturn (paymentMode );
6363 }
64-
64+
6565 @ Test
6666 public void fill_shouldClearBillableServiceWhenSwitchingToStockItem () {
6767 CashierItemPrice instance = new CashierItemPrice ();
6868 BillableService existing = new BillableService ();
6969 existing .setUuid (BILLABLE_SERVICE_UUID );
7070 instance .setBillableService (existing );
71-
71+
7272 StockItem stockItem = new StockItem ();
7373 stockItem .setUuid (STOCK_ITEM_UUID );
7474 when (stockManagementService .getStockItemByUuid (STOCK_ITEM_UUID )).thenReturn (stockItem );
75-
75+
7676 CsvLine line = new CsvLine (HEADERS ,
7777 new String [] { "" , "Switched Price" , "100.00" , PAYMENT_MODE_UUID , STOCK_ITEM_UUID , "" });
78-
78+
7979 processor .fill (instance , line );
80-
80+
8181 assertSame (stockItem , instance .getItem ());
8282 assertNull (instance .getBillableService ());
8383 }
84-
84+
8585 @ Test
8686 public void fill_shouldClearItemWhenSwitchingToBillableService () {
8787 CashierItemPrice instance = new CashierItemPrice ();
8888 StockItem existing = new StockItem ();
8989 existing .setUuid (STOCK_ITEM_UUID );
9090 instance .setItem (existing );
91-
91+
9292 BillableService billableService = new BillableService ();
9393 billableService .setUuid (BILLABLE_SERVICE_UUID );
9494 when (billableServiceService .getBillableServiceByUuid (BILLABLE_SERVICE_UUID )).thenReturn (billableService );
95-
95+
9696 CsvLine line = new CsvLine (HEADERS ,
9797 new String [] { "" , "Switched Price" , "100.00" , PAYMENT_MODE_UUID , "" , BILLABLE_SERVICE_UUID });
98-
98+
9999 processor .fill (instance , line );
100-
100+
101101 assertSame (billableService , instance .getBillableService ());
102102 assertNull (instance .getItem ());
103103 }
104-
104+
105105 @ Test
106106 public void fill_shouldSetBasicFields () {
107107 CashierItemPrice instance = new CashierItemPrice ();
108108 BillableService billableService = new BillableService ();
109109 billableService .setUuid (BILLABLE_SERVICE_UUID );
110110 when (billableServiceService .getBillableServiceByUuid (BILLABLE_SERVICE_UUID )).thenReturn (billableService );
111-
111+
112112 CsvLine line = new CsvLine (HEADERS ,
113113 new String [] { "" , "ANC Service Price" , "150.00" , PAYMENT_MODE_UUID , "" , BILLABLE_SERVICE_UUID });
114-
114+
115115 processor .fill (instance , line );
116-
116+
117117 assertEquals ("ANC Service Price" , instance .getName ());
118118 assertEquals (new BigDecimal ("150.00" ), instance .getPrice ());
119119 assertSame (paymentMode , instance .getPaymentMode ());
120120 }
121-
121+
122122 @ Test (expected = IllegalArgumentException .class )
123123 public void fill_shouldRejectWhenBothAssociationsSet () {
124124 CashierItemPrice instance = new CashierItemPrice ();
125- CsvLine line = new CsvLine (HEADERS , new String [] { "" , "Price" , "100.00" , PAYMENT_MODE_UUID , STOCK_ITEM_UUID ,
126- BILLABLE_SERVICE_UUID });
125+ CsvLine line = new CsvLine (HEADERS ,
126+ new String [] { "" , "Price" , "100.00" , PAYMENT_MODE_UUID , STOCK_ITEM_UUID , BILLABLE_SERVICE_UUID });
127127 processor .fill (instance , line );
128128 }
129-
129+
130130 @ Test (expected = IllegalArgumentException .class )
131131 public void fill_shouldRejectWhenNeitherAssociationSet () {
132132 CashierItemPrice instance = new CashierItemPrice ();
133133 CsvLine line = new CsvLine (HEADERS , new String [] { "" , "Price" , "100.00" , PAYMENT_MODE_UUID , "" , "" });
134134 processor .fill (instance , line );
135135 }
136- }
136+ }
0 commit comments