mirror of
https://github.com/octoleo/plantuml.git
synced 2024-06-07 02:40:52 +00:00
e11d974ce5
Create `test` folder with: - `example` - `utils` And put all `net.sourceforge.plantuml.test` on `test.utils`. _[no other change]_
26 lines
819 B
Java
26 lines
819 B
Java
package test.utils;
|
|
|
|
import org.junit.jupiter.params.converter.ArgumentConversionException;
|
|
import org.junit.jupiter.params.converter.SimpleArgumentConverter;
|
|
|
|
import net.sourceforge.plantuml.json.Json;
|
|
import net.sourceforge.plantuml.json.JsonValue;
|
|
|
|
/**
|
|
* Class to help test with `Junit`.
|
|
*/
|
|
public class JunitUtils {
|
|
/**
|
|
* `StringJsonConverter` class to use with `@ConvertWith`.
|
|
*/
|
|
public static class StringJsonConverter extends SimpleArgumentConverter {
|
|
@Override
|
|
protected Object convert(Object source, Class<?> targetType) throws ArgumentConversionException {
|
|
if (source instanceof String)
|
|
return (JsonValue) Json.parse((String) source);
|
|
else
|
|
throw new IllegalArgumentException("Conversion from " + source.getClass() + " to "
|
|
+ targetType + " not supported.");
|
|
}
|
|
}
|
|
} |