AccountBalanceLineParserV1 implements AccountBalanceLineParser { @Override public AccountBalance parse(String line, long consensusTimestamp, long systemShardNum) { try { if (line == null) { throw new InvalidDatasetException("Null line cannot be parsed"); } List<String> parts = SPLITTER.splitToList(line); if (parts.size() != 4) { throw new InvalidDatasetException("Invalid account balance line: " + line); } long shardNum = Long.parseLong(parts.get(0)); int realmNum = Integer.parseInt(parts.get(1)); int accountNum = Integer.parseInt(parts.get(2)); long balance = Long.parseLong(parts.get(3)); if (shardNum < 0 || realmNum < 0 || accountNum < 0 || balance < 0) { throw new InvalidDatasetException("Invalid account balance line: " + line); } if (shardNum != systemShardNum) { throw new InvalidDatasetException(String.format("Invalid account balance line: %s. Expect " + "shard (%d), got shard (%d)", line, systemShardNum, shardNum)); } return new AccountBalance(balance, Collections .emptyList(), new AccountBalance.Id(consensusTimestamp, EntityId .of(shardNum, realmNum, accountNum, EntityTypeEnum.ACCOUNT))); } catch (NumberFormatException ex) { throw new InvalidDatasetException("Invalid account balance line: " + line, ex); } }  @Override AccountBalance parse(String line, long consensusTimestamp, long systemShardNum);  }
@Test void parseNullLine() { assertThrows(InvalidDatasetException.class, () -> { parser.parse(null, timestamp, systemShardNum); }); }