Skip to content

Commit

Permalink
Change enum error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
kelvinqian00 committed Dec 13, 2024
1 parent 3f4ba30 commit c3fad8e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static InteractionType getByDisplayName(String name) {
return t;
}
}
throw new IllegalArgumentException("Bad InteractionType Value");
throw new IllegalArgumentException("Invalid InteractionType value: " + name);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/yetanalytics/xapi/model/ObjectType.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static ObjectType getByDisplayName(String name) {
return t;
}
}
throw new IllegalArgumentException("Bad ObjectType Value");
throw new IllegalArgumentException("Invalid ObjectType value: " + name);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/com/yetanalytics/ValueExceptionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,15 @@ public void testInvalidVersion() {

public void testInvalidObjectType() {
String objTypeStr = "{\"objectType\": \"Person\"}";
String errMsg = "Bad ObjectType Value";
String errMsg = "Invalid ObjectType value: Person";
JsonProcessingException exception = assertThrows(JsonProcessingException.class,
() -> Mapper.getMapper().readValue(objTypeStr, Agent.class));
assertEquals(errMsg, exception.getOriginalMessage());
}

public void testinvalidInteractiontype() {
String intTypeStr = "{\"interactionType\": \"unknown\"}";
String errMsg = "Bad InteractionType Value";
String errMsg = "Invalid InteractionType value: unknown";
JsonProcessingException exception = assertThrows(JsonProcessingException.class,
() -> Mapper.getMapper().readValue(intTypeStr, ActivityDefinition.class));
assertEquals(errMsg, exception.getOriginalMessage());
Expand Down

0 comments on commit c3fad8e

Please sign in to comment.