#1313 Rename DomesticTax,ForeignTax and review fixes
This commit is contained in:
@ -24,8 +24,8 @@
|
||||
package com.iluwatar.separatedinterface;
|
||||
|
||||
import com.iluwatar.separatedinterface.invoice.InvoiceGenerator;
|
||||
import com.iluwatar.separatedinterface.taxes.DomesticTax;
|
||||
import com.iluwatar.separatedinterface.taxes.ForeignTax;
|
||||
import com.iluwatar.separatedinterface.taxes.DomesticTaxCalculator;
|
||||
import com.iluwatar.separatedinterface.taxes.ForeignTaxCalculator;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -51,11 +51,12 @@ public class App {
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
//Create the invoice generator with product cost as 50 and foreign product tax
|
||||
var internationalProductInvoice = new InvoiceGenerator(PRODUCT_COST, new ForeignTax());
|
||||
var internationalProductInvoice = new InvoiceGenerator(PRODUCT_COST,
|
||||
new ForeignTaxCalculator());
|
||||
LOGGER.info("Foreign Tax applied: {}", "" + internationalProductInvoice.getAmountWithTax());
|
||||
|
||||
//Create the invoice generator with product cost as 50 and domestic product tax
|
||||
var domesticProductInvoice = new InvoiceGenerator(PRODUCT_COST, new DomesticTax());
|
||||
var domesticProductInvoice = new InvoiceGenerator(PRODUCT_COST, new DomesticTaxCalculator());
|
||||
LOGGER.info("Domestic Tax applied: {}", "" + domesticProductInvoice.getAmountWithTax());
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ import com.iluwatar.separatedinterface.invoice.TaxCalculator;
|
||||
/**
|
||||
* TaxCalculator for Domestic goods with 20% tax.
|
||||
*/
|
||||
public class DomesticTax implements TaxCalculator {
|
||||
public class DomesticTaxCalculator implements TaxCalculator {
|
||||
|
||||
public static final double TAX_PERCENTAGE = 20;
|
||||
|
@ -28,7 +28,7 @@ import com.iluwatar.separatedinterface.invoice.TaxCalculator;
|
||||
/**
|
||||
* TaxCalculator for foreign goods with 60% tax.
|
||||
*/
|
||||
public class ForeignTax implements TaxCalculator {
|
||||
public class ForeignTaxCalculator implements TaxCalculator {
|
||||
|
||||
public static final double TAX_PERCENTAGE = 60;
|
||||
|
@ -26,13 +26,13 @@ package com.iluwatar.separatedinterface.taxes;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class DomesticTaxTest {
|
||||
public class DomesticTaxCalculatorTest {
|
||||
|
||||
private DomesticTax target;
|
||||
private DomesticTaxCalculator target;
|
||||
|
||||
@Test
|
||||
public void testTaxCaluclation(){
|
||||
target = new DomesticTax();
|
||||
public void testTaxCalculation(){
|
||||
target = new DomesticTaxCalculator();
|
||||
|
||||
var tax=target.calculate(100.0);
|
||||
Assertions.assertEquals(tax,20.0);
|
@ -26,13 +26,13 @@ package com.iluwatar.separatedinterface.taxes;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class ForeignTaxTest {
|
||||
public class ForeignTaxCalculatorTest {
|
||||
|
||||
private ForeignTax target;
|
||||
private ForeignTaxCalculator target;
|
||||
|
||||
@Test
|
||||
public void testTaxCaluclation(){
|
||||
target = new ForeignTax();
|
||||
public void testTaxCalculation(){
|
||||
target = new ForeignTaxCalculator();
|
||||
|
||||
var tax=target.calculate(100.0);
|
||||
Assertions.assertEquals(tax,60.0);
|
Reference in New Issue
Block a user