ru.tinkoff.kora.test.extension.junit5.GraphCandidate Maven / Gradle / Ivy
package ru.tinkoff.kora.test.extension.junit5;
import jakarta.annotation.Nonnull;
import java.lang.reflect.Type;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
record GraphCandidate(@Nonnull Type type, @Nonnull List> tags) {
GraphCandidate(Type type) {
this(type, Collections.emptyList());
}
GraphCandidate(Type type, Class>[] tags) {
this(type, (tags == null) ? Collections.emptyList() : Arrays.asList(tags));
}
public Class>[] tagsAsArray() {
return tags.toArray(Class[]::new);
}
@Override
public String toString() {
return tags.isEmpty()
? type.toString()
: "[type=" + type + ", tags=" + tags + ']';
}
}