This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Inject BinarySearchSolver solver; | |
... | |
Function<Double, Affordability> affordabilityFn ...; // our mapping function that takes a number and returns an affordability | |
Function<Affordability, Boolean> manageableTargetTest = affordability -> affordability.getOrdinal() <= MANAGEABLE.getOrdinal(); | |
double maxManageablePrice = solver.solveForMaxValuePassingTargetTest( | |
lowerBound, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
“affordability”: “MANAGEABLE”, | |
“mortgageAffordability”: “MEDIUM”, | |
“dtiRatio”: 0.32, | |
“desiredDtiRatio”: 0.29, | |
“downPaymentRatio”: 0.2, | |
“desiredDownPaymentRatio”: 0.15, | |
“retirementImpact”: “NONE”, | |
“mortgageWillForeclose”: false | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Map<Account, Double> getSavingsRecommendations( | |
double savingsToAllocate, | |
Collection<Account> accounts, | |
Collection<Goal> goals); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AccountSavingsRecommender { | |
@Inject RetirementGoalSavingsAllocator retirementAllocator; | |
@VisibleForTesting | |
Map<Goal, Double> computePvByGoal(Collection<Goal> goals) {...} | |
…… | |
@VisibleForTesting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AccountSavingsRecommenderTest { | |
private final Mockery mockery = new Mockery(); | |
private final RetirementGoalSavingsAllocator retirementAllocator = mockery.mock(RetirementGoalSavingsAllocator.class); | |
@Test | |
public void computePvByGoal_retirement() { | |
Account retirementAccount = TestAccountFactory.exampleRetirementAccount(); | |
mockery.checking(new Expectations() {{ | |
oneOf(retirementAllocator).getAccountForPvCalculation(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AccountSavingsRecommenderIntegrationTest { | |
private static final LocalDate today = new LocalDate(2018, 6, 25); | |
private AccountSavingsRecommender getRecommender() { | |
AccountSavingsRecommender recommender = new AccountSavingsRecommender(); | |
RetirementGoalSavingsAllocator retirementAllocator = new RetirementGoalSavingsAllocator(); | |
retirementAllocator.today = today; | |
RetirementAccountSelector accountSelector = new RetirementAccountSelector(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Account realisticRetirementAccount = RetirementAccount.builder() | |
.withInvestedBalance(34_332.67) | |
.withCashBalance(2_190.95) | |
.withType(Type.R_401_K) | |
.withExpectedAccountReturn(0.057) | |
.build(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"banner": {"institutions": ["CHASE"], "text": "Linking in progress", "button": "Link more"}, | |
"hub": [{"institution": "CHASE", "title": "Linking in progress", "subtitle": "This usually takes about 1 minute for Chase."}] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"actionType": "ACTION", | |
"title": "Check your credentials", | |
"subtitle": "Looks like an incorrect username or password for Vanguard.", | |
"cta": "Try again" | |
} |