Skip to content

Commit

Permalink
Removed unnecessary if/else statement
Browse files Browse the repository at this point in the history
Thanks to Neelam's advice, I noticed that I was doing an unnecessary step. Now, was able to simplify by removing if/else statement in the test agents.
  • Loading branch information
matthewd0123 committed Apr 11, 2024
1 parent dc3a458 commit 7843387
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,7 @@ private static Object handleValidateUriCommand(Map<String, Object> jsonData) {
String valType = (String) data.get("type");
String uriValue = (String) data.get("uri");

UUri uri;
if (uriValue != null) {
uri = LongUriSerializer.instance().deserialize(uriValue);
} else {
uri = LongUriSerializer.instance().deserialize(null);
}
UUri uri = LongUriSerializer.instance().deserialize(uriValue);

Function<UUri, ValidationResult> validatorFunc = null;
Function<UUri, Boolean> validatorFuncBool = null;
Expand Down
5 changes: 1 addition & 4 deletions test_agent/python/testagent.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,7 @@ def handle_uri_deserialize_command(json_msg):

def handle_uri_validate_command(json_msg):
val_type = json_msg["data"]["type"]
if json_msg["data"].get("uri") is not None:
uri = LongUriSerializer().deserialize(json_msg["data"]["uri"])
else:
uri = LongUriSerializer().deserialize(None)
uri = LongUriSerializer().deserialize(json_msg["data"].get("uri"))

validator_func = {
"uri": UriValidator.validate,
Expand Down

0 comments on commit 7843387

Please sign in to comment.