Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bael-3966: code fixes after editor review #9203

Merged
merged 4 commits into from
May 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions core-java-modules/core-java-lang-operators/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
</parent>

<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>
<!-- test scoped -->
<dependency>
<groupId>org.assertj</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;

import org.junit.Ignore;
import org.junit.Test;

public class CreditAppUnitTest {
Expand Down Expand Up @@ -40,13 +41,28 @@ public void givenUser_whenIsInstanceOfLender_thenDowncast() {
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
public void givenBorrower_whenLoanAmountIsDouble_thenRequestLoan() {
Borrower borrower = new Borrower();
double amount = 100.0;

//if(amount instanceof Double) // Compilation error, no autoboxing
if(Double.class.isInstance(amount)) {
if(Double.class.isInstance(amount)) { // No compilation error
borrower.requestLoan(amount);
}
assertEquals(100, borrower.getTotalLoanAmount());
Expand All @@ -57,8 +73,7 @@ public void givenBorrower_whenLoanAmountIsNotString_thenRequestLoan() {
Borrower borrower = new Borrower();
Double amount = 100.0;

//if(amount instanceof String) // Compilation error, incompatible operands
if(!String.class.isInstance(amount)) {
if(!String.class.isInstance(amount)) { // No compilation error
borrower.requestLoan(amount);
}
assertEquals(100, borrower.getTotalLoanAmount());
Expand Down