PropInfo { public int getTargetType(PropertyDefinition def) { int target = def.getRequiredType(); if (target != PropertyType.UNDEFINED) { return target; } else if (type != PropertyType.UNDEFINED) { return type; } else { return PropertyType.STRING; } } PropInfo(@Nullable String name, int type, @NotNull TextValue value);  PropInfo(@Nullable String name, int type, @NotNull List<? extends TextValue> values);  PropInfo(@Nullable String name, int type,
                    @NotNull List<? extends TextValue> values,
                    @NotNull MultipleStatus multipleStatus); void dispose(); int getTargetType(PropertyDefinition def); @Nullable String getName(); int getType(); boolean isUnknownMultiple(); @NotNull TextValue getTextValue(); @NotNull List<? extends TextValue> getTextValues(); @NotNull Value getValue(int targetType); @NotNull List<Value> getValues(int targetType); PropertyState asPropertyState(@NotNull PropertyDefinition propertyDefinition);  }
@Test public void getTargetTypeRequiredTypeBoolean() throws Exception { PropInfo propInfo = new PropInfo("undef", PropertyType.UNDEFINED, mockTextValue("value",PropertyType.STRING)); PropertyDefinition def = mockPropDef(PropertyType.BOOLEAN, false); assertEquals(PropertyType.BOOLEAN, propInfo.getTargetType(def)); }
@Test public void getTargetTypeRequiredTypeUndefined() throws Exception { PropInfo prop = new PropInfo("long", PropertyType.LONG, mockTextValue("23",PropertyType.LONG)); PropInfo undef = new PropInfo("undef", PropertyType.UNDEFINED, mockTextValue("value",PropertyType.UNDEFINED)); PropertyDefinition def = mockPropDef(PropertyType.UNDEFINED, false); assertEquals(PropertyType.LONG, prop.getTargetType(def)); assertEquals(PropertyType.STRING, undef.getTargetType(def)); }