📍Use lombok, reformat, and optimize the code (#1560)
* Use lombok, reformat, and optimize the code * Fix merge conflicts and some sonar issues Co-authored-by: va1m <va1m@email.com>
This commit is contained in:
@ -26,8 +26,7 @@ package com.iluwatar.separatedinterface;
|
||||
import com.iluwatar.separatedinterface.invoice.InvoiceGenerator;
|
||||
import com.iluwatar.separatedinterface.taxes.DomesticTaxCalculator;
|
||||
import com.iluwatar.separatedinterface.taxes.ForeignTaxCalculator;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* <p>The Separated Interface pattern encourages to separate the interface definition and
|
||||
@ -38,10 +37,9 @@ import org.slf4j.LoggerFactory;
|
||||
* {@link com.iluwatar.separatedinterface.invoice.TaxCalculator} implementations located in separate
|
||||
* packages, to receive different responses for both of the implementations.</p>
|
||||
*/
|
||||
@Slf4j
|
||||
public class App {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(App.class);
|
||||
|
||||
public static final double PRODUCT_COST = 50.0;
|
||||
|
||||
/**
|
||||
|
@ -23,17 +23,20 @@
|
||||
|
||||
package com.iluwatar.separatedinterface.invoice;
|
||||
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
public class InvoiceGeneratorTest {
|
||||
class InvoiceGeneratorTest {
|
||||
|
||||
private InvoiceGenerator target;
|
||||
|
||||
@Test
|
||||
public void testGenerateTax() {
|
||||
void testGenerateTax() {
|
||||
var productCost = 50.0;
|
||||
var tax = 10.0;
|
||||
TaxCalculator taxCalculatorMock = mock(TaxCalculator.class);
|
||||
|
@ -26,16 +26,16 @@ package com.iluwatar.separatedinterface.taxes;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class DomesticTaxCalculatorTest {
|
||||
class DomesticTaxCalculatorTest {
|
||||
|
||||
private DomesticTaxCalculator target;
|
||||
|
||||
@Test
|
||||
public void testTaxCalculation(){
|
||||
void testTaxCalculation() {
|
||||
target = new DomesticTaxCalculator();
|
||||
|
||||
var tax=target.calculate(100.0);
|
||||
Assertions.assertEquals(tax,20.0);
|
||||
var tax = target.calculate(100.0);
|
||||
Assertions.assertEquals(tax, 20.0);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -26,16 +26,16 @@ package com.iluwatar.separatedinterface.taxes;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class ForeignTaxCalculatorTest {
|
||||
class ForeignTaxCalculatorTest {
|
||||
|
||||
private ForeignTaxCalculator target;
|
||||
|
||||
@Test
|
||||
public void testTaxCalculation(){
|
||||
void testTaxCalculation() {
|
||||
target = new ForeignTaxCalculator();
|
||||
|
||||
var tax=target.calculate(100.0);
|
||||
Assertions.assertEquals(tax,60.0);
|
||||
var tax = target.calculate(100.0);
|
||||
Assertions.assertEquals(tax, 60.0);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user