javeme commented on code in PR #285:
URL:
https://github.com/apache/incubator-hugegraph-computer/pull/285#discussion_r1510173486
##########
computer-test/src/main/java/org/apache/hugegraph/computer/core/util/IdUtilTest.java:
##########
@@ -25,14 +26,32 @@ public class IdUtilTest {
@Test
public void testParseId() {
- String utf81 = "\"abc\"";
- String utf82 = "\"222\"";
- String l = "222";
- String uuid = "U\"3b676b77-c484-4ba6-b627-8c040bc42863\"";
+ String idUtf8WithString = "\"abc\"";
+ String idUtf8WithNumber = "\"222\"";
+ String idLong = "222";
+ String idUuid = "U\"3b676b77-c484-4ba6-b627-8c040bc42863\"";
- Assert.assertEquals(IdType.UTF8, IdUtil.parseId(utf81).idType());
- Assert.assertEquals(IdType.UTF8, IdUtil.parseId(utf82).idType());
- Assert.assertEquals(IdType.LONG, IdUtil.parseId(l).idType());
- Assert.assertEquals(IdType.UUID, IdUtil.parseId(uuid).idType());
+ String idNull = null;
+ String idEmpty = "";
+ String idDouble = "1.23";
+ String idUuidInvalid = "U\"123\"";
+
+ Assert.assertEquals(IdType.UTF8,
IdUtil.parseId(idUtf8WithString).idType());
+ Assert.assertEquals(IdType.UTF8,
IdUtil.parseId(idUtf8WithNumber).idType());
+ Assert.assertEquals(IdType.LONG, IdUtil.parseId(idLong).idType());
+ Assert.assertEquals(IdType.UUID, IdUtil.parseId(idUuid).idType());
+
+ Assert.assertThrows(ComputerException.class, () -> {
+ IdUtil.parseId(idNull).idType();
+ });
+ Assert.assertThrows(ComputerException.class, () -> {
Review Comment:
also keep IllegalArgumentException?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]