use of com.djrapitops.plan.extension.annotation.PluginInfo in project Plan by plan-player-analytics.
the class ClassValuePairOrderTest method booleansWithConditionsComeFirst.
@Test
void booleansWithConditionsComeFirst() throws NoSuchMethodException {
@PluginInfo(name = "Extension")
class Extension implements DataExtension {
@Conditional("condition")
@StringProvider(text = "a")
public String value() {
return "";
}
@Conditional("condition2")
@StringProvider(text = "a")
public String value2() {
return "";
}
}
ExtDataBuilder builder = new ExtDataBuilder(new Extension());
DataValue<Boolean> first = builder.valueBuilder("test").buildBooleanProvidingCondition(false, "condition");
DataValue<Boolean> second = builder.valueBuilder("test").conditional(Extension.class.getMethod("value").getAnnotation(Conditional.class)).buildBooleanProvidingCondition(false, "condition2");
DataValue<String> third = builder.valueBuilder("test").conditional(Extension.class.getMethod("value2").getAnnotation(Conditional.class)).buildString("e");
builder.addValue(String.class, third);
builder.addValue(String.class, third);
builder.addValue(String.class, third);
builder.addValue(Boolean.class, second);
builder.addValue(Boolean.class, first);
List<ExtDataBuilder.ClassValuePair> expected = Arrays.asList(new ExtDataBuilder.ClassValuePair(Boolean.class, first), new ExtDataBuilder.ClassValuePair(Boolean.class, second), new ExtDataBuilder.ClassValuePair(String.class, third), new ExtDataBuilder.ClassValuePair(String.class, third), new ExtDataBuilder.ClassValuePair(String.class, third));
List<ExtDataBuilder.ClassValuePair> result = builder.getValues();
assertEquals(expected, result);
}
use of com.djrapitops.plan.extension.annotation.PluginInfo in project Plan by plan-player-analytics.
the class ClassValuePairOrderTest method booleansWithConditionsComeFirst2.
@Test
void booleansWithConditionsComeFirst2() throws NoSuchMethodException {
@PluginInfo(name = "Extension")
class Extension implements DataExtension {
@Conditional("condition")
@StringProvider(text = "a")
public String value() {
return "";
}
@Conditional("condition2")
@StringProvider(text = "a")
public String value2() {
return "";
}
}
ExtDataBuilder builder = new ExtDataBuilder(new Extension());
DataValue<Boolean> first = builder.valueBuilder("test").buildBooleanProvidingCondition(false, "condition");
DataValue<Boolean> second = builder.valueBuilder("test").conditional(Extension.class.getMethod("value").getAnnotation(Conditional.class)).buildBooleanProvidingCondition(false, "condition2");
DataValue<String> third = builder.valueBuilder("test").conditional(Extension.class.getMethod("value2").getAnnotation(Conditional.class)).buildString("e");
builder.addValue(String.class, third);
builder.addValue(String.class, third);
builder.addValue(Boolean.class, first);
builder.addValue(Boolean.class, second);
builder.addValue(String.class, third);
List<ExtDataBuilder.ClassValuePair> expected = Arrays.asList(new ExtDataBuilder.ClassValuePair(Boolean.class, first), new ExtDataBuilder.ClassValuePair(Boolean.class, second), new ExtDataBuilder.ClassValuePair(String.class, third), new ExtDataBuilder.ClassValuePair(String.class, third), new ExtDataBuilder.ClassValuePair(String.class, third));
List<ExtDataBuilder.ClassValuePair> result = builder.getValues();
assertEquals(expected, result);
}
use of com.djrapitops.plan.extension.annotation.PluginInfo in project Plan by plan-player-analytics.
the class ClassValuePairOrderTest method booleansComeFirst.
@Test
void booleansComeFirst() throws NoSuchMethodException {
@PluginInfo(name = "Extension")
class Extension implements DataExtension {
@Conditional("condition")
@StringProvider(text = "a")
public String value() {
return "";
}
}
ExtDataBuilder builder = new ExtDataBuilder(new Extension());
DataValue<Boolean> first = builder.valueBuilder("test").buildBooleanProvidingCondition(false, "condition");
DataValue<String> second = builder.valueBuilder("test").conditional(Extension.class.getMethod("value").getAnnotation(Conditional.class)).buildString("e");
builder.addValue(String.class, second);
builder.addValue(String.class, second);
builder.addValue(String.class, second);
builder.addValue(Boolean.class, first);
List<ExtDataBuilder.ClassValuePair> expected = Arrays.asList(new ExtDataBuilder.ClassValuePair(Boolean.class, first), new ExtDataBuilder.ClassValuePair(String.class, second), new ExtDataBuilder.ClassValuePair(String.class, second), new ExtDataBuilder.ClassValuePair(String.class, second));
List<ExtDataBuilder.ClassValuePair> result = builder.getValues();
assertEquals(expected, result);
}
use of com.djrapitops.plan.extension.annotation.PluginInfo in project Plan by plan-player-analytics.
the class ClassValuePairOrderTest method providedConditionsComeBeforeConditions.
@Test
void providedConditionsComeBeforeConditions() throws NoSuchMethodException {
@PluginInfo(name = "Extension")
class Extension implements DataExtension {
@Conditional("condition")
@StringProvider(text = "a")
public String value() {
return "";
}
}
ExtDataBuilder builder = new ExtDataBuilder(new Extension());
DataValue<Boolean> first = builder.valueBuilder("test").buildBooleanProvidingCondition(false, "condition");
DataValue<Boolean> second = builder.valueBuilder("test").conditional(Extension.class.getMethod("value").getAnnotation(Conditional.class)).buildBoolean(false);
builder.addValue(Boolean.class, second);
builder.addValue(Boolean.class, first);
List<ExtDataBuilder.ClassValuePair> expected = Arrays.asList(new ExtDataBuilder.ClassValuePair(Boolean.class, first), new ExtDataBuilder.ClassValuePair(Boolean.class, second));
List<ExtDataBuilder.ClassValuePair> result = builder.getValues();
assertEquals(expected, result);
}
Aggregations