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

Add RewardValue class and unit tests for cash to miles conversion #1460

Open
wants to merge 1 commit into
base: flow
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions src/main/java/RewardValue.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package PACKAGE_NAME;

public class RewardValue {
}
13 changes: 9 additions & 4 deletions src/test/java/RewardValueTests.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

public class RewardValueTests {
Expand All @@ -20,11 +19,17 @@ void create_with_miles_value() {

@Test
void convert_from_cash_to_miles() {
assert false;
double cashValue = 100;
var rewardValue = new RewardValue(cashValue);
int expectedMilesValue = (int) (cashValue / 0.02); // Assuming conversion rate is 1 mile = $0.02
assertEquals(expectedMilesValue, rewardValue.getMilesValue());
}

@Test
void convert_from_miles_to_cash() {
assert false;
int milesValue = 10000;
var rewardValue = new RewardValue(milesValue);
double expectedCashValue = milesValue * 0.02; // Assuming conversion rate is 1 mile = $0.02
assertEquals(expectedCashValue, rewardValue.getCashValue());
}
}
}