/** Sets all the required prerequisites for the tests. Will be called before the test are run. */ @Before public void setUp() { Basket_in = new TCreate_Input(); Basket_up = new TUpdate_Input(); BasketAttr_in = new TAttribute("IsAddressOK", "1", null, null); BasketAttr_up = new TAttribute("IsAddressOK", "0", null, null); Address_in = new TAddressNamed(); // init input address data Address_in.setEMail("*****@*****.**"); Address_in.setFirstName("Klaus"); Address_in.setLastName("Klaussen"); Address_in.setCity("Klausdorf"); Address_in.setZipcode("08151"); Address_in.setCountryID(BigInteger.valueOf(276)); Address_in.setStreet("Musterstraße 2"); Address_in.setStreet2("Ortsteil Niederfingeln"); Address_in.setAttributes( new TAttribute[] { new TAttribute("JobTitle", "best Job", null, null), new TAttribute("Salutation", "Dr.", null, null), }); Address_up = Address_in; // just update some fields Address_up.setFirstName("Hans"); Address_up.setLastName("Hanssen"); Address_up.setStreet("Musterstraße 2b"); Address_up.setStreet2("Ortsteil Oberfingeln"); Basket_in.setBillingAddress(Address_in); Basket_in.setAttributes(new TAttribute[] {BasketAttr_in}); TLineItemContainerIn lineItemContainer = new TLineItemContainerIn(); lineItemContainer.setCurrencyID("EUR"); lineItemContainer.setPaymentMethod("PaymentMethods/Invoice"); lineItemContainer.setShippingMethod("ShippingMethods/Express"); lineItemContainer.setTaxArea("/TaxMatrixGermany/EU"); lineItemContainer.setTaxModel("gross"); String productGuid = productService.getInfo(new String[] {"Products/ho_1112105010"}, new String[] {"GUID"})[0] .getAttributes()[0].getValue(); assertNotNull(productGuid); lineItemContainer.setProductLineItems( new TProductLineItemIn[] {new TProductLineItemIn(productGuid, (float) 10)}); Basket_in.setLineItemContainer(lineItemContainer); // init order update data Basket_up.setBillingAddress(Address_up); Basket_up.setAttributes(new TAttribute[] {BasketAttr_up}); // delete the test order if it exists TExists_Return[] Baskets_exists_out = basketService.exists(new String[] {BasketPath}); if (Baskets_exists_out[0].getExists()) { TDelete_Return[] Baskets_delete_out = basketService.delete(new String[] {BasketPath}); assertNoError(Baskets_delete_out[0].getError()); } }
/** * test exists method * * @param expected if false, test is successful if the Order does NOT exists */ public void testExists(boolean expected) { TExists_Return[] Baskets_exists_out = basketService.exists(new String[] {BasketPath}); assertNoError(Baskets_exists_out[0].getError()); assertEquals("exists?", expected, Baskets_exists_out[0].getExists()); }