EncodedIdToEntityConverter implements Converter<Long, Entity> { @Override public Entity convert(Long encodedId) { if (encodedId == null || encodedId < 0) { return null; } long shard = encodedId >> (REALM_BITS + NUM_BITS); long realm = (encodedId >> NUM_BITS) & REALM_MASK; long num = encodedId & NUM_MASK; Entity.EntityBuilder builder = Entity.builder() .entityNum(num) .entityRealm(realm) .entityShard(shard) .id(encodedId) .entityTypeId(EntityType.ACCOUNT); return builder.build(); }  @Override Entity convert(Long encodedId); static final EncodedIdToEntityConverter INSTANCE; }
@Test void convertNull() { Entity result = converter.convert(null); assertNull(result); }