@Test public void should_create_obj_and_assign_references2() throws UserAlreadyExistsException, ProductCategoryOrLabelException { // given Product product1 = TestDataBuilder.build_blackIPhone(); Product product2 = TestDataBuilder.build_whiteIPhone(); Collection<Product> products = new ArrayList<Product>(); products.add(product1); products.add(product2); User u1 = TestDataBuilder.build_johe_at_gmail(); User u2 = TestDataBuilder.build_mahe_at_gmail(); // when Shop store = Shop.createStore("rybnik", 200, 30.0); UserShop us1 = UserShop.createUserShop(u1, new Money(100l), null, null); UserShop us2 = UserShop.createUserShop(u2, new Money(200l), null, null); Collection<UserShop> uss = new ArrayList<UserShop>(); uss.add(us1); uss.add(us2); store.setUserStores(uss); store.setProducts(products); // then assertNotNull(store); assertTrue(store.getProducts().contains(product1)); assertTrue(store.getProducts().contains(product2)); assertEquals(product1.getStore(), store); assertEquals(product2.getStore(), store); }
@Test public void should_calculate_tax_for_small_typical_shop_created_by_default() { // given Shop shop = Shop.createStore("rybnik", 100, 50.0); assertEquals(shop.calculateTaxToPay(), 270.0, 1.0); }
@Test public void should_calculate_tax_for_huge_typical_shop() { // given Shop shop = Shop.createStore("rybnik", 100, 50.0, AdditionalStoreType.HUGE, AdditionalTaxType.TYPICAL); assertEquals(shop.calculateTaxToPay(), 1250.0, 1.0); }
@Test public void should_calculate_tax_for_huge_shopping_mall() { // given Shop shop = Shop.createStore( "rybnik", 100, 50.0, AdditionalStoreType.HUGE, AdditionalTaxType.SHOPPING_MALL); assertEquals(shop.calculateTaxToPay(), 2400.0, 1.0); }
@Test public void should_calculate_tax_for_middle_sized_shopping_mall() { // given Shop shop = Shop.createStore( "rybnik", 100, 50.0, AdditionalStoreType.MIDDLE_SIZED, AdditionalTaxType.SHOPPING_MALL); assertEquals(shop.calculateTaxToPay(), 800.0, 1.0); }
@Test public void should_calculate_tax_for_middle_sized_typical_shop() { // given Shop shop = Shop.createStore( "rybnik", 100, 50.0, AdditionalStoreType.MIDDLE_SIZED, AdditionalTaxType.TYPICAL); assertEquals(shop.calculateTaxToPay(), 450.0, 1.0); }
@Test public void should_create_obj_and_assign_references() throws ProductCategoryOrLabelException { // given Product product1 = TestDataBuilder.build_blackIPhone(); Product product2 = TestDataBuilder.build_whiteIPhone(); // when Shop store = Shop.createStore("rybnik", 200, Arrays.asList(product1, product2)); // then assertNotNull(store); assertTrue(store.getProducts().contains(product1)); assertTrue(store.getProducts().contains(product2)); assertEquals(product1.getStore(), store); assertEquals(product2.getStore(), store); }