Bael-3966: code fixes after editor review (#9203)

This commit is contained in:
Aaron Juarez 2020-05-01 15:35:29 -04:00 committed by GitHub
parent e65cfc7bd0
commit 9797d3a4fc
5 changed files with 25 additions and 4 deletions

View File

@ -17,6 +17,12 @@
</parent> </parent>
<dependencies> <dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>
<!-- test scoped --> <!-- test scoped -->
<dependency> <dependency>
<groupId>org.assertj</groupId> <groupId>org.assertj</groupId>

View File

@ -5,6 +5,7 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
public class CreditAppUnitTest { public class CreditAppUnitTest {
@ -40,13 +41,28 @@ public class CreditAppUnitTest {
assertNotNull(lender); assertNotNull(lender);
} }
@Ignore
@Test
public void givenBorrower_whenDoubleOrNotString_thenRequestLoan() {
Borrower borrower = new Borrower();
double amount = 100.0;
/*if(amount instanceof Double) { // Compilation error, no autoboxing
borrower.requestLoan(amount);
}
if(!(amount instanceof String)) { // Compilation error, incompatible operands
borrower.requestLoan(amount);
}*/
}
@Test @Test
public void givenBorrower_whenLoanAmountIsDouble_thenRequestLoan() { public void givenBorrower_whenLoanAmountIsDouble_thenRequestLoan() {
Borrower borrower = new Borrower(); Borrower borrower = new Borrower();
double amount = 100.0; double amount = 100.0;
//if(amount instanceof Double) // Compilation error, no autoboxing if(Double.class.isInstance(amount)) { // No compilation error
if(Double.class.isInstance(amount)) {
borrower.requestLoan(amount); borrower.requestLoan(amount);
} }
assertEquals(100, borrower.getTotalLoanAmount()); assertEquals(100, borrower.getTotalLoanAmount());
@ -57,8 +73,7 @@ public class CreditAppUnitTest {
Borrower borrower = new Borrower(); Borrower borrower = new Borrower();
Double amount = 100.0; Double amount = 100.0;
//if(amount instanceof String) // Compilation error, incompatible operands if(!String.class.isInstance(amount)) { // No compilation error
if(!String.class.isInstance(amount)) {
borrower.requestLoan(amount); borrower.requestLoan(amount);
} }
assertEquals(100, borrower.getTotalLoanAmount()); assertEquals(100, borrower.getTotalLoanAmount());