diff --git a/exercises/version-workflow/README.md b/exercises/version-workflow/README.md
index 48e9260..50ad894 100644
--- a/exercises/version-workflow/README.md
+++ b/exercises/version-workflow/README.md
@@ -120,7 +120,7 @@ String versionKey = "MovedThankYouAfterLoop";
int version = Workflow.getVersion(versionKey, Workflow.DEFAULT_VERSION, 1);
if (version != Workflow.DEFAULT_VERSION) {
-Workflow.upsertTypedSearchAttributes(TEMPORAL_CHANGE_VERSION
+ Workflow.upsertTypedSearchAttributes(TEMPORAL_CHANGE_VERSION
.valueSet(Arrays.asList((versionKey + "-" + version))));
}
```
diff --git a/exercises/version-workflow/practice/pom.xml b/exercises/version-workflow/practice/pom.xml
index 5bb7cc3..3a46749 100644
--- a/exercises/version-workflow/practice/pom.xml
+++ b/exercises/version-workflow/practice/pom.xml
@@ -22,7 +22,7 @@
io.temporal
temporal-sdk
- 1.31.0
+ 1.32.1
@@ -40,14 +40,14 @@
io.temporal
temporal-testing
- 1.31.0
+ 1.32.1
test
org.junit.jupiter
junit-jupiter
- 5.14.1
+ 5.11.4
test
diff --git a/exercises/version-workflow/practice/src/main/java/getversion/Constants.java b/exercises/version-workflow/practice/src/main/java/getversion/Constants.java
index 0113d44..b737104 100644
--- a/exercises/version-workflow/practice/src/main/java/getversion/Constants.java
+++ b/exercises/version-workflow/practice/src/main/java/getversion/Constants.java
@@ -2,6 +2,6 @@
public class Constants {
- public static final String taskQueueName = "loan-processing-workflow-taskqueue";
+ public static final String TASK_QUEUE_NAME = "loan-processing-workflow-taskqueue";
}
diff --git a/exercises/version-workflow/practice/src/main/java/getversion/LoanProcessingActivities.java b/exercises/version-workflow/practice/src/main/java/getversion/LoanProcessingActivities.java
index 5e417ad..7b0c33d 100644
--- a/exercises/version-workflow/practice/src/main/java/getversion/LoanProcessingActivities.java
+++ b/exercises/version-workflow/practice/src/main/java/getversion/LoanProcessingActivities.java
@@ -7,8 +7,8 @@
@ActivityInterface
public interface LoanProcessingActivities {
- public String chargeCustomer(ChargeInput input);
+ String chargeCustomer(ChargeInput input);
- public String sendThankYouToCustomer(CustomerInfo input);
+ String sendThankYouToCustomer(CustomerInfo input);
}
diff --git a/exercises/version-workflow/practice/src/main/java/getversion/LoanProcessingWorker.java b/exercises/version-workflow/practice/src/main/java/getversion/LoanProcessingWorker.java
index 40ba8ca..f1c803a 100644
--- a/exercises/version-workflow/practice/src/main/java/getversion/LoanProcessingWorker.java
+++ b/exercises/version-workflow/practice/src/main/java/getversion/LoanProcessingWorker.java
@@ -12,7 +12,7 @@ public static void main(String[] args) {
WorkflowClient client = WorkflowClient.newInstance(service);
WorkerFactory factory = WorkerFactory.newInstance(client);
- Worker worker = factory.newWorker(Constants.taskQueueName);
+ Worker worker = factory.newWorker(Constants.TASK_QUEUE_NAME);
worker.registerWorkflowImplementationTypes(LoanProcessingWorkflowImpl.class);
diff --git a/exercises/version-workflow/practice/src/main/java/getversion/LoanProcessingWorkflow.java b/exercises/version-workflow/practice/src/main/java/getversion/LoanProcessingWorkflow.java
index da61a95..88b1d2a 100644
--- a/exercises/version-workflow/practice/src/main/java/getversion/LoanProcessingWorkflow.java
+++ b/exercises/version-workflow/practice/src/main/java/getversion/LoanProcessingWorkflow.java
@@ -8,6 +8,6 @@
public interface LoanProcessingWorkflow {
@WorkflowMethod
- public String loanProcessingWorkflow(CustomerInfo info);
+ String loanProcessingWorkflow(CustomerInfo info);
}
diff --git a/exercises/version-workflow/practice/src/main/java/getversion/LoanProcessingWorkflowImpl.java b/exercises/version-workflow/practice/src/main/java/getversion/LoanProcessingWorkflowImpl.java
index aecd13e..d9094cc 100644
--- a/exercises/version-workflow/practice/src/main/java/getversion/LoanProcessingWorkflowImpl.java
+++ b/exercises/version-workflow/practice/src/main/java/getversion/LoanProcessingWorkflowImpl.java
@@ -8,6 +8,7 @@
import org.slf4j.Logger;
import java.time.Duration;
+import java.util.Arrays;
import java.util.List;
public class LoanProcessingWorkflowImpl implements LoanProcessingWorkflow {
@@ -26,7 +27,6 @@ public String loanProcessingWorkflow(CustomerInfo info) {
String customerId = info.getCustomerID();
int amount = info.getAmount();
- String email = info.getEmailAddress();
int numberOfPeriods = info.getNumberOfPeriods();
int totalPaid = 0;
diff --git a/exercises/version-workflow/practice/src/main/java/getversion/Starter.java b/exercises/version-workflow/practice/src/main/java/getversion/Starter.java
index 2612751..c7808b4 100644
--- a/exercises/version-workflow/practice/src/main/java/getversion/Starter.java
+++ b/exercises/version-workflow/practice/src/main/java/getversion/Starter.java
@@ -22,7 +22,8 @@ public static void main(String[] args) {
WorkflowOptions options = WorkflowOptions.newBuilder()
.setWorkflowId("loan-processing-workflow-customer-" + info.getCustomerID())
- .setTaskQueue(Constants.taskQueueName).build();
+ .setTaskQueue(Constants.TASK_QUEUE_NAME)
+ .build();
LoanProcessingWorkflow workflow = client.newWorkflowStub(LoanProcessingWorkflow.class, options);
diff --git a/exercises/version-workflow/practice/src/main/java/getversion/model/ChargeInput.java b/exercises/version-workflow/practice/src/main/java/getversion/model/ChargeInput.java
index f45a905..ed37163 100644
--- a/exercises/version-workflow/practice/src/main/java/getversion/model/ChargeInput.java
+++ b/exercises/version-workflow/practice/src/main/java/getversion/model/ChargeInput.java
@@ -1,26 +1,26 @@
package getversion.model;
public class ChargeInput {
- private String customerID;
+ private String customerId;
private int amount;
private int periodNumber;
private int numberOfPeriods;
public ChargeInput() {}
- public ChargeInput(String customerID, int amount, int periodNumber, int numberOfPeriods) {
- this.customerID = customerID;
+ public ChargeInput(String customerId, int amount, int periodNumber, int numberOfPeriods) {
+ this.customerId = customerId;
this.amount = amount;
this.periodNumber = periodNumber;
this.numberOfPeriods = numberOfPeriods;
}
public String getCustomerID() {
- return customerID;
+ return customerId;
}
- public void setCustomerID(String customerID) {
- this.customerID = customerID;
+ public void setCustomerID(String customerId) {
+ this.customerId = customerId;
}
public int getAmount() {
diff --git a/exercises/version-workflow/practice/src/main/java/getversion/model/CustomerInfo.java b/exercises/version-workflow/practice/src/main/java/getversion/model/CustomerInfo.java
index 77db37e..ebc102e 100644
--- a/exercises/version-workflow/practice/src/main/java/getversion/model/CustomerInfo.java
+++ b/exercises/version-workflow/practice/src/main/java/getversion/model/CustomerInfo.java
@@ -1,7 +1,7 @@
package getversion.model;
public class CustomerInfo {
- private String customerID;
+ private String customerId;
private String name;
private String emailAddress;
private int amount;
@@ -9,9 +9,8 @@ public class CustomerInfo {
public CustomerInfo() {}
- public CustomerInfo(String customerID, String name, String emailAddress, int amount,
- int numberOfPeriods) {
- this.customerID = customerID;
+ public CustomerInfo(String customerId, String name, String emailAddress, int amount, int numberOfPeriods) {
+ this.customerId = customerId;
this.name = name;
this.emailAddress = emailAddress;
this.amount = amount;
@@ -19,11 +18,11 @@ public CustomerInfo(String customerID, String name, String emailAddress, int amo
}
public String getCustomerID() {
- return customerID;
+ return customerId;
}
- public void setCustomerID(String customerID) {
- this.customerID = customerID;
+ public void setCustomerID(String customerId) {
+ this.customerId = customerId;
}
public String getName() {
diff --git a/exercises/version-workflow/practice/src/main/java/getversion/model/SimpleCustomerMap.java b/exercises/version-workflow/practice/src/main/java/getversion/model/SimpleCustomerMap.java
index 4fc9d2e..bf903a0 100644
--- a/exercises/version-workflow/practice/src/main/java/getversion/model/SimpleCustomerMap.java
+++ b/exercises/version-workflow/practice/src/main/java/getversion/model/SimpleCustomerMap.java
@@ -15,8 +15,7 @@ private void populate() {
CustomerInfo customer01 = new CustomerInfo("a100", "Ana Garcia", "ana@example.com", 500, 10);
CustomerInfo customer02 = new CustomerInfo("a101", "Amit Singh", "asingh@example.com", 250, 15);
- CustomerInfo customer03 =
- new CustomerInfo("a102", "Mary O'Connor", "marymo@example.com", 425, 12);
+ CustomerInfo customer03 = new CustomerInfo("a102", "Mary O'Connor", "marymo@example.com", 425, 12);
customers.put(customer01.getCustomerID(), customer01);
customers.put(customer02.getCustomerID(), customer02);
@@ -24,8 +23,8 @@ private void populate() {
}
@Override
- public CustomerInfo get(String customerID) {
- CustomerInfo info = customers.get(customerID);
+ public CustomerInfo get(String customerId) {
+ CustomerInfo info = customers.get(customerId);
if (info == null) {
throw new RuntimeException("Customer ID does not exist in the database");
}
diff --git a/exercises/version-workflow/solution/pom.xml b/exercises/version-workflow/solution/pom.xml
index 955b1f0..9ccb3d2 100644
--- a/exercises/version-workflow/solution/pom.xml
+++ b/exercises/version-workflow/solution/pom.xml
@@ -22,7 +22,7 @@
io.temporal
temporal-sdk
- 1.31.0
+ 1.32.1
@@ -40,14 +40,14 @@
io.temporal
temporal-testing
- 1.31.0
+ 1.32.1
test
org.junit.jupiter
junit-jupiter
- 5.14.1
+ 5.11.4
test
diff --git a/exercises/version-workflow/solution/src/main/java/getversion/Constants.java b/exercises/version-workflow/solution/src/main/java/getversion/Constants.java
index 0113d44..b737104 100644
--- a/exercises/version-workflow/solution/src/main/java/getversion/Constants.java
+++ b/exercises/version-workflow/solution/src/main/java/getversion/Constants.java
@@ -2,6 +2,6 @@
public class Constants {
- public static final String taskQueueName = "loan-processing-workflow-taskqueue";
+ public static final String TASK_QUEUE_NAME = "loan-processing-workflow-taskqueue";
}
diff --git a/exercises/version-workflow/solution/src/main/java/getversion/LoanProcessingActivities.java b/exercises/version-workflow/solution/src/main/java/getversion/LoanProcessingActivities.java
index 5e417ad..7b0c33d 100644
--- a/exercises/version-workflow/solution/src/main/java/getversion/LoanProcessingActivities.java
+++ b/exercises/version-workflow/solution/src/main/java/getversion/LoanProcessingActivities.java
@@ -7,8 +7,8 @@
@ActivityInterface
public interface LoanProcessingActivities {
- public String chargeCustomer(ChargeInput input);
+ String chargeCustomer(ChargeInput input);
- public String sendThankYouToCustomer(CustomerInfo input);
+ String sendThankYouToCustomer(CustomerInfo input);
}
diff --git a/exercises/version-workflow/solution/src/main/java/getversion/LoanProcessingActivitiesImpl.java b/exercises/version-workflow/solution/src/main/java/getversion/LoanProcessingActivitiesImpl.java
index 255e3ae..1dd8c9d 100644
--- a/exercises/version-workflow/solution/src/main/java/getversion/LoanProcessingActivitiesImpl.java
+++ b/exercises/version-workflow/solution/src/main/java/getversion/LoanProcessingActivitiesImpl.java
@@ -11,16 +11,16 @@ public class LoanProcessingActivitiesImpl implements LoanProcessingActivities {
@Override
public String chargeCustomer(ChargeInput input) {
- String customerID = input.getCustomerID();
+ String customerId = input.getCustomerID();
int amount = input.getAmount();
int numberOfPeriods = input.getNumberOfPeriods();
logger.info("*** Charging customer***: CustomerID: {}, Amount {}, Number of Periods: {}",
- customerID, amount, numberOfPeriods);
+ customerId, amount, numberOfPeriods);
// pretend we charge them
- String confirmation = String.format("Charged %d to customer '%s'", amount, customerID);
+ String confirmation = String.format("Charged %d to customer '%s'", amount, customerId);
return confirmation;
@@ -29,14 +29,14 @@ public String chargeCustomer(ChargeInput input) {
@Override
public String sendThankYouToCustomer(CustomerInfo input) {
- String customerID = input.getCustomerID();
+ String customerId = input.getCustomerID();
String email = input.getEmailAddress();
logger.info("*** Sending thank you message to Customer ***: CustomerID: {}, Email {}",
- customerID, email);
+ customerId, email);
- String confirmation = String.format("Sent thank you message to customer '%s'", customerID);
+ String confirmation = String.format("Sent thank you message to customer '%s'", customerId);
return confirmation;
}
diff --git a/exercises/version-workflow/solution/src/main/java/getversion/LoanProcessingWorker.java b/exercises/version-workflow/solution/src/main/java/getversion/LoanProcessingWorker.java
index 40ba8ca..f1c803a 100644
--- a/exercises/version-workflow/solution/src/main/java/getversion/LoanProcessingWorker.java
+++ b/exercises/version-workflow/solution/src/main/java/getversion/LoanProcessingWorker.java
@@ -12,7 +12,7 @@ public static void main(String[] args) {
WorkflowClient client = WorkflowClient.newInstance(service);
WorkerFactory factory = WorkerFactory.newInstance(client);
- Worker worker = factory.newWorker(Constants.taskQueueName);
+ Worker worker = factory.newWorker(Constants.TASK_QUEUE_NAME);
worker.registerWorkflowImplementationTypes(LoanProcessingWorkflowImpl.class);
diff --git a/exercises/version-workflow/solution/src/main/java/getversion/LoanProcessingWorkflow.java b/exercises/version-workflow/solution/src/main/java/getversion/LoanProcessingWorkflow.java
index da61a95..88b1d2a 100644
--- a/exercises/version-workflow/solution/src/main/java/getversion/LoanProcessingWorkflow.java
+++ b/exercises/version-workflow/solution/src/main/java/getversion/LoanProcessingWorkflow.java
@@ -8,6 +8,6 @@
public interface LoanProcessingWorkflow {
@WorkflowMethod
- public String loanProcessingWorkflow(CustomerInfo info);
+ String loanProcessingWorkflow(CustomerInfo info);
}
diff --git a/exercises/version-workflow/solution/src/main/java/getversion/LoanProcessingWorkflowImpl.java b/exercises/version-workflow/solution/src/main/java/getversion/LoanProcessingWorkflowImpl.java
index 50013d3..c4cee7c 100644
--- a/exercises/version-workflow/solution/src/main/java/getversion/LoanProcessingWorkflowImpl.java
+++ b/exercises/version-workflow/solution/src/main/java/getversion/LoanProcessingWorkflowImpl.java
@@ -17,8 +17,9 @@ public class LoanProcessingWorkflowImpl implements LoanProcessingWorkflow {
public static final SearchAttributeKey> TEMPORAL_CHANGE_VERSION = SearchAttributeKey.forKeywordList("TemporalChangeVersion");
- ActivityOptions options =
- ActivityOptions.newBuilder().setStartToCloseTimeout(Duration.ofSeconds(5)).build();
+ ActivityOptions options = ActivityOptions.newBuilder()
+ .setStartToCloseTimeout(Duration.ofSeconds(5))
+ .build();
private final LoanProcessingActivities activities =
Workflow.newActivityStub(LoanProcessingActivities.class, options);
@@ -59,8 +60,7 @@ public String loanProcessingWorkflow(CustomerInfo info) {
}
if (version == 1) {
- // for workflow executions started before the change, send thank you before the
- // loop
+ // for workflow executions started before the change, send thank you before the loop
String confirmation = activities.sendThankYouToCustomer(info);
}
diff --git a/exercises/version-workflow/solution/src/main/java/getversion/Starter.java b/exercises/version-workflow/solution/src/main/java/getversion/Starter.java
index 6bffc12..c7808b4 100644
--- a/exercises/version-workflow/solution/src/main/java/getversion/Starter.java
+++ b/exercises/version-workflow/solution/src/main/java/getversion/Starter.java
@@ -22,7 +22,7 @@ public static void main(String[] args) {
WorkflowOptions options = WorkflowOptions.newBuilder()
.setWorkflowId("loan-processing-workflow-customer-" + info.getCustomerID())
- .setTaskQueue(Constants.taskQueueName)
+ .setTaskQueue(Constants.TASK_QUEUE_NAME)
.build();
LoanProcessingWorkflow workflow = client.newWorkflowStub(LoanProcessingWorkflow.class, options);
diff --git a/exercises/version-workflow/solution/src/main/java/getversion/model/ChargeInput.java b/exercises/version-workflow/solution/src/main/java/getversion/model/ChargeInput.java
index 73dae9b..ed37163 100644
--- a/exercises/version-workflow/solution/src/main/java/getversion/model/ChargeInput.java
+++ b/exercises/version-workflow/solution/src/main/java/getversion/model/ChargeInput.java
@@ -1,50 +1,49 @@
package getversion.model;
public class ChargeInput {
- private String customerID;
- private int amount;
- private int periodNumber;
- private int numberOfPeriods;
-
- public ChargeInput() {
- }
-
- public ChargeInput(String customerID, int amount, int periodNumber, int numberOfPeriods) {
- this.customerID = customerID;
- this.amount = amount;
- this.periodNumber = periodNumber;
- this.numberOfPeriods = numberOfPeriods;
- }
-
- public String getCustomerID() {
- return customerID;
- }
-
- public void setCustomerID(String customerID) {
- this.customerID = customerID;
- }
-
- public int getAmount() {
- return amount;
- }
-
- public void setAmount(int amount) {
- this.amount = amount;
- }
-
- public int getPeriodNumber() {
- return periodNumber;
- }
-
- public void setPeriodNumber(int periodNumber) {
- this.periodNumber = periodNumber;
- }
-
- public int getNumberOfPeriods() {
- return numberOfPeriods;
- }
-
- public void setNumberOfPeriods(int numberOfPeriods) {
- this.numberOfPeriods = numberOfPeriods;
- }
+ private String customerId;
+ private int amount;
+ private int periodNumber;
+ private int numberOfPeriods;
+
+ public ChargeInput() {}
+
+ public ChargeInput(String customerId, int amount, int periodNumber, int numberOfPeriods) {
+ this.customerId = customerId;
+ this.amount = amount;
+ this.periodNumber = periodNumber;
+ this.numberOfPeriods = numberOfPeriods;
+ }
+
+ public String getCustomerID() {
+ return customerId;
+ }
+
+ public void setCustomerID(String customerId) {
+ this.customerId = customerId;
+ }
+
+ public int getAmount() {
+ return amount;
+ }
+
+ public void setAmount(int amount) {
+ this.amount = amount;
+ }
+
+ public int getPeriodNumber() {
+ return periodNumber;
+ }
+
+ public void setPeriodNumber(int periodNumber) {
+ this.periodNumber = periodNumber;
+ }
+
+ public int getNumberOfPeriods() {
+ return numberOfPeriods;
+ }
+
+ public void setNumberOfPeriods(int numberOfPeriods) {
+ this.numberOfPeriods = numberOfPeriods;
+ }
}
diff --git a/exercises/version-workflow/solution/src/main/java/getversion/model/CustomerInfo.java b/exercises/version-workflow/solution/src/main/java/getversion/model/CustomerInfo.java
index 719d251..ebc102e 100644
--- a/exercises/version-workflow/solution/src/main/java/getversion/model/CustomerInfo.java
+++ b/exercises/version-workflow/solution/src/main/java/getversion/model/CustomerInfo.java
@@ -1,61 +1,59 @@
package getversion.model;
public class CustomerInfo {
- private String customerID;
- private String name;
- private String emailAddress;
- private int amount;
- private int numberOfPeriods;
-
- public CustomerInfo() {
-
- }
-
- public CustomerInfo(String customerID, String name, String emailAddress, int amount, int numberOfPeriods) {
- this.customerID = customerID;
- this.name = name;
- this.emailAddress = emailAddress;
- this.amount = amount;
- this.numberOfPeriods = numberOfPeriods;
- }
-
- public String getCustomerID() {
- return customerID;
- }
-
- public void setCustomerID(String customerID) {
- this.customerID = customerID;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getEmailAddress() {
- return emailAddress;
- }
-
- public void setEmailAddress(String emailAddress) {
- this.emailAddress = emailAddress;
- }
-
- public int getAmount() {
- return amount;
- }
-
- public void setAmount(int amount) {
- this.amount = amount;
- }
-
- public int getNumberOfPeriods() {
- return numberOfPeriods;
- }
-
- public void setNumberOfPeriods(int numberOfPeriods) {
- this.numberOfPeriods = numberOfPeriods;
- }
+ private String customerId;
+ private String name;
+ private String emailAddress;
+ private int amount;
+ private int numberOfPeriods;
+
+ public CustomerInfo() {}
+
+ public CustomerInfo(String customerId, String name, String emailAddress, int amount, int numberOfPeriods) {
+ this.customerId = customerId;
+ this.name = name;
+ this.emailAddress = emailAddress;
+ this.amount = amount;
+ this.numberOfPeriods = numberOfPeriods;
+ }
+
+ public String getCustomerID() {
+ return customerId;
+ }
+
+ public void setCustomerID(String customerId) {
+ this.customerId = customerId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getEmailAddress() {
+ return emailAddress;
+ }
+
+ public void setEmailAddress(String emailAddress) {
+ this.emailAddress = emailAddress;
+ }
+
+ public int getAmount() {
+ return amount;
+ }
+
+ public void setAmount(int amount) {
+ this.amount = amount;
+ }
+
+ public int getNumberOfPeriods() {
+ return numberOfPeriods;
+ }
+
+ public void setNumberOfPeriods(int numberOfPeriods) {
+ this.numberOfPeriods = numberOfPeriods;
+ }
}
diff --git a/exercises/version-workflow/solution/src/main/java/getversion/model/CustomerInfoDatabase.java b/exercises/version-workflow/solution/src/main/java/getversion/model/CustomerInfoDatabase.java
index baa2242..0b2798c 100644
--- a/exercises/version-workflow/solution/src/main/java/getversion/model/CustomerInfoDatabase.java
+++ b/exercises/version-workflow/solution/src/main/java/getversion/model/CustomerInfoDatabase.java
@@ -1,5 +1,5 @@
package getversion.model;
public interface CustomerInfoDatabase {
- CustomerInfo get(String customerID);
+ CustomerInfo get(String customerId);
}
diff --git a/exercises/version-workflow/solution/src/main/java/getversion/model/SimpleCustomerMap.java b/exercises/version-workflow/solution/src/main/java/getversion/model/SimpleCustomerMap.java
index 0d942e2..bf903a0 100644
--- a/exercises/version-workflow/solution/src/main/java/getversion/model/SimpleCustomerMap.java
+++ b/exercises/version-workflow/solution/src/main/java/getversion/model/SimpleCustomerMap.java
@@ -4,31 +4,31 @@
import java.util.Map;
public class SimpleCustomerMap implements CustomerInfoDatabase {
- private Map customers;
+ private Map customers;
- public SimpleCustomerMap() {
- populate();
- }
-
- private void populate() {
- customers = new HashMap<>();
+ public SimpleCustomerMap() {
+ populate();
+ }
- CustomerInfo customer01 = new CustomerInfo("a100", "Ana Garcia", "ana@example.com", 500, 10);
- CustomerInfo customer02 = new CustomerInfo("a101", "Amit Singh", "asingh@example.com", 250, 15);
- CustomerInfo customer03 = new CustomerInfo("a102", "Mary O'Connor", "marymo@example.com", 425, 12);
+ private void populate() {
+ customers = new HashMap<>();
- customers.put(customer01.getCustomerID(), customer01);
- customers.put(customer02.getCustomerID(), customer02);
- customers.put(customer03.getCustomerID(), customer03);
- }
+ CustomerInfo customer01 = new CustomerInfo("a100", "Ana Garcia", "ana@example.com", 500, 10);
+ CustomerInfo customer02 = new CustomerInfo("a101", "Amit Singh", "asingh@example.com", 250, 15);
+ CustomerInfo customer03 = new CustomerInfo("a102", "Mary O'Connor", "marymo@example.com", 425, 12);
- @Override
- public CustomerInfo get(String customerID) {
- CustomerInfo info = customers.get(customerID);
- if (info == null) {
- throw new RuntimeException("Customer ID does not exist in the database");
- }
+ customers.put(customer01.getCustomerID(), customer01);
+ customers.put(customer02.getCustomerID(), customer02);
+ customers.put(customer03.getCustomerID(), customer03);
+ }
- return info;
+ @Override
+ public CustomerInfo get(String customerId) {
+ CustomerInfo info = customers.get(customerId);
+ if (info == null) {
+ throw new RuntimeException("Customer ID does not exist in the database");
}
+
+ return info;
+ }
}
diff --git a/samples/fetch-event-history/RequestHistory.java b/samples/fetch-event-history/RequestHistory.java
index 167db1f..8f210bd 100644
--- a/samples/fetch-event-history/RequestHistory.java
+++ b/samples/fetch-event-history/RequestHistory.java
@@ -1,5 +1,3 @@
-package getversion;
-
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;