@Test void getTypedValueStringAttributeEntityManagerXref() { String valueStr = "0"; Attribute attr = mock(Attribute.class); EntityType refEntityType = mock(EntityType.class); Attribute refIdAttr = mock(Attribute.class); when(refIdAttr.getDataType()).thenReturn(STRING); when(refEntityType.getIdAttribute()).thenReturn(refIdAttr); when(attr.hasRefEntity()).thenReturn(true); when(attr.getRefEntity()).thenReturn(refEntityType); when(attr.getDataType()).thenReturn(XREF); Entity entity = mock(Entity.class); EntityManager entityManager = mock(EntityManager.class); when(entityManager.getReference(refEntityType, valueStr)).thenReturn(entity); assertEquals(entity, getTypedValue(valueStr, attr, entityManager)); }
public static Object getTypedValue(String valueStr, Attribute attr) { if (EntityTypeUtils.isReferenceType(attr)) { throw new MolgenisDataException( "getTypedValue(String, AttributeMetadata) can't be used for attributes referencing entities"); } return getTypedValue(valueStr, attr, null); }
EntityUtils { public static Object getTypedValue(String valueStr, Attribute attr) { if (EntityTypeUtils.isReferenceType(attr)) { throw new MolgenisDataException( "getTypedValue(String, AttributeMetadata) can't be used for attributes referencing entities"); } return getTypedValue(valueStr, attr, null); } }
EntityUtils { public static Object getTypedValue(String valueStr, Attribute attr) { if (EntityTypeUtils.isReferenceType(attr)) { throw new MolgenisDataException( "getTypedValue(String, AttributeMetadata) can't be used for attributes referencing entities"); } return getTypedValue(valueStr, attr, null); } private  EntityUtils(); }
EntityUtils { public static Object getTypedValue(String valueStr, Attribute attr) { if (EntityTypeUtils.isReferenceType(attr)) { throw new MolgenisDataException( "getTypedValue(String, AttributeMetadata) can't be used for attributes referencing entities"); } return getTypedValue(valueStr, attr, null); } private  EntityUtils(); static Object getTypedValue(String valueStr, Attribute attr); static Object getTypedValue(String valueStr, Attribute attr, EntityManager entityManager); static boolean equals(EntityType entityType, EntityType otherEntityType); static boolean equals(Iterable<Attribute> attrsIt, Iterable<Attribute> otherAttrsIt); static boolean equalsEntities(
      Iterable<Entity> entityIterable, Iterable<Entity> otherEntityIterable); static boolean equals(Tag tag, Tag otherTag); static boolean equals(Attribute attr, Attribute otherAttr); static boolean equals(Attribute attr, Attribute otherAttr, boolean checkIdentifier); static boolean equals(Entity entity, Entity otherEntity); static int hashCode(Entity entity); static boolean isNullValue(Entity entity, Attribute attribute); static boolean isSame(Entity thisEntity, Entity thatEntity); }
EntityUtils { public static Object getTypedValue(String valueStr, Attribute attr) { if (EntityTypeUtils.isReferenceType(attr)) { throw new MolgenisDataException( "getTypedValue(String, AttributeMetadata) can't be used for attributes referencing entities"); } return getTypedValue(valueStr, attr, null); } private  EntityUtils(); static Object getTypedValue(String valueStr, Attribute attr); static Object getTypedValue(String valueStr, Attribute attr, EntityManager entityManager); static boolean equals(EntityType entityType, EntityType otherEntityType); static boolean equals(Iterable<Attribute> attrsIt, Iterable<Attribute> otherAttrsIt); static boolean equalsEntities(
      Iterable<Entity> entityIterable, Iterable<Entity> otherEntityIterable); static boolean equals(Tag tag, Tag otherTag); static boolean equals(Attribute attr, Attribute otherAttr); static boolean equals(Attribute attr, Attribute otherAttr, boolean checkIdentifier); static boolean equals(Entity entity, Entity otherEntity); static int hashCode(Entity entity); static boolean isNullValue(Entity entity, Attribute attribute); static boolean isSame(Entity thisEntity, Entity thatEntity);  }