Skip to content

Commit

Permalink
spotless 🙄
Browse files Browse the repository at this point in the history
  • Loading branch information
aarsilv committed Aug 8, 2024
1 parent 5384bd2 commit efed6f4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 21 deletions.
26 changes: 13 additions & 13 deletions src/main/java/cloud/eppo/EppoClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -437,19 +437,19 @@ public BanditResult getBanditAction(
if (banditLogger != null) {
try {
BanditAssignment banditAssignment =
new BanditAssignment(
flagKey,
banditKey,
subjectKey,
banditResult.getActionKey(),
banditResult.getActionWeight(),
banditResult.getOptimalityGap(),
banditParameters.getModelVersion(),
subjectAttributes.getNumericAttributes(),
subjectAttributes.getCategoricalAttributes(),
banditResult.getActionAttributes().getNumericAttributes(),
banditResult.getActionAttributes().getCategoricalAttributes(),
buildLogMetaData());
new BanditAssignment(
flagKey,
banditKey,
subjectKey,
banditResult.getActionKey(),
banditResult.getActionWeight(),
banditResult.getOptimalityGap(),
banditParameters.getModelVersion(),
subjectAttributes.getNumericAttributes(),
subjectAttributes.getCategoricalAttributes(),
banditResult.getActionAttributes().getNumericAttributes(),
banditResult.getActionAttributes().getCategoricalAttributes(),
buildLogMetaData());

banditLogger.logBanditAssignment(banditAssignment);
} catch (Exception e) {
Expand Down
11 changes: 6 additions & 5 deletions src/test/java/cloud/eppo/EppoClientBanditTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -333,20 +333,21 @@ public void testBanditErrorGracefulModeOn() {
@Test
public void testBanditLogErrorNonFatal() {
initClient();
doThrow(new RuntimeException("Mock Bandit Logging Error")).when(mockBanditLogger).logBanditAssignment(any());
doThrow(new RuntimeException("Mock Bandit Logging Error"))
.when(mockBanditLogger)
.logBanditAssignment(any());

BanditActions actions = new BanditActions();
actions.put("nike", new Attributes());
actions.put("adidas", new Attributes());
BanditResult banditResult =
EppoClient.getInstance()
.getBanditAction(
"banner_bandit_flag", "subject", new Attributes(), actions, "default");
EppoClient.getInstance()
.getBanditAction("banner_bandit_flag", "subject", new Attributes(), actions, "default");
assertEquals("banner_bandit", banditResult.getVariation());
assertEquals("nike", banditResult.getAction());

ArgumentCaptor<BanditAssignment> banditLogCaptor =
ArgumentCaptor.forClass(BanditAssignment.class);
ArgumentCaptor.forClass(BanditAssignment.class);
verify(mockBanditLogger, times(1)).logBanditAssignment(banditLogCaptor.capture());
}

Expand Down
8 changes: 5 additions & 3 deletions src/test/java/cloud/eppo/EppoClientTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -377,10 +377,12 @@ public void testAssignmentEventCorrectlyCreated() {
@Test
public void testAssignmentLogErrorNonFatal() {
initClient();
doThrow(new RuntimeException("Mock Assignment Logging Error")).when(mockAssignmentLogger).logAssignment(any());
doThrow(new RuntimeException("Mock Assignment Logging Error"))
.when(mockAssignmentLogger)
.logAssignment(any());
double assignment =
EppoClient.getInstance()
.getDoubleAssignment("numeric_flag", "alice", new Attributes(), 0.0);
EppoClient.getInstance()
.getDoubleAssignment("numeric_flag", "alice", new Attributes(), 0.0);

assertEquals(3.1415926, assignment, 0.0000001);

Expand Down

0 comments on commit efed6f4

Please sign in to comment.