import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.restconf.api.FormatParameters;
+import org.opendaylight.restconf.api.query.PrettyPrintParam;
import org.opendaylight.restconf.server.api.DatabindContext;
import org.opendaylight.yangtools.yang.common.Decimal64;
import org.opendaylight.yangtools.yang.common.QName;
public abstract class AbstractJukeboxTest {
@FunctionalInterface
- protected interface FormatMethod {
+ public interface FormatMethod {
- void invoke(@NonNull OutputStream out) throws IOException;
+ void invoke(@NonNull FormatParameters format, @NonNull OutputStream out) throws IOException;
}
// container jukebox
return new ByteArrayInputStream(str.getBytes(StandardCharsets.UTF_8));
}
- protected static void assertFormat(final String expected, final FormatMethod formatMethod) {
+ public static void assertFormat(final String expected, final FormatMethod formatMethod,
+ final boolean prettyPrint) {
final var baos = new ByteArrayOutputStream();
try {
- formatMethod.invoke(baos);
+ formatMethod.invoke(new FormatParameters(PrettyPrintParam.of(prettyPrint)), baos);
} catch (IOException e) {
throw new AssertionError(e);
}