@Test(expected = ApiException.class) public void createInsufficientCustomer() throws IOException { final Customer newCustomer = new Customer(); newCustomer.withAddress( new PrimaryAddress() .withZipcode("2345") .withStreetAddress("Testg 1") .withCareof("CO foobar") .withUseCareofAsAttention(false) .withCity("MMX") .withCountry("SE")); newCustomer.withContact( new Contact().withEmail("*****@*****.**").withName("Foo Bar").withPhone("+46112112112")); newCustomer.withDeliveryAddress( new DeliveryAddress() .withStreetAddress("Leveransgatan 1") .withCareof("NA") .withZipcode("12345") .withName("アップデート前にゲーム") .withCountry("SE") .withCity("MMA")); newCustomer.withOrgNo("777777-7777").withVatNo("12345678"); final CustomerResponse customerResponse = customerClient.create(newCustomer); customerClient.update(customerResponse.getData()); }
@Test public void searchCustomer() throws IOException { final Customer customer = CustomerHelper.createCustomer(customerClient); Search<CustomerFilterField, CustomerOrderField> search = new Search<>(); search.withFilter( FilterType.FIELD, CustomerFilterField.CUSTOMER_NO, customer.getCustomerNo().toString()); search.withOrder(SortDirection.ASCENDING, CustomerOrderField.CREATED_AT); final CustomerSearchResponse response = customerClient.search(search); assertEquals(response.getData().size(), 1); assertEquals(customer.getCustomerNo(), response.getData().get(0).getCustomerNo()); }