LiteralAttribute extends AbstractIndexableAttribute { @Override public int getValueIndex(Object value) { return (value instanceof String) ? indexMap.getIfAbsent(value, -1) : -1; } LiteralAttribute(String key, AttributeLevel level); @Override int registerXAttribute(XAttribute attr); @Override ImmutableList<Object> getValues(); @Override int getValueIndex(Object value); @Override Object getValue(int index); @Override int getValueSize();  }
@Test public void testGetValueIndex() { LiteralAttribute att = this.newWithTwoValues("concept:name", AttributeLevel.EVENT); Assert.assertEquals(att.getValueIndex("test1"), 0); Assert.assertEquals(att.getValueIndex("test2"), 1); LiteralAttribute att2 = this.newWithInvalidKeyAttribute("invalid key", AttributeLevel.EVENT); Object result2 = att2.getValueIndex("test1"); Assert.assertEquals(-1, result2); LiteralAttribute att3 = this.newEmptyAttribute("concept:name", AttributeLevel.EVENT); Object result3 = att3.getValueIndex("test1"); Assert.assertEquals(-1, result3); }