### Question:
LivyRestModelTransformer { public static TransformResponse toTransformResponse(Statement statement, String transformId) { TransformResponse transformResponse = prepTransformResponse(statement, transformId); if (transformResponse.getStatus() == TransformResponse.Status.SUCCESS) { String code = statement.getCode().trim(); if (code.endsWith("dfResultsAsJson")) { transformResponse.setResults(toTransformQueryResultWithSchema(transformResponse, statement.getOutput())); } else if (code.endsWith("dfProf")) { List<OutputRow> rows = toTransformResponseProfileStats(statement.getOutput()); transformResponse.setProfile(toTransformResponseProfileStats(statement.getOutput())); transformResponse.setActualCols(1); Integer actualRows = rows.stream() .filter(metric -> metric.getMetricType().equals(MetricType.TOTAL_COUNT.toString())) .map(metric -> Integer.valueOf(metric.getMetricValue())) .findFirst().orElse(1); transformResponse.setActualRows(actualRows); transformResponse.setResults(emptyResult()); } else if (code.endsWith("transformAsStr")) { TransformResponse tr = serializeStatementOutputResponse(checkCodeWasWellFormed(statement.getOutput()), TransformResponse.class); statementIdCache.put(tr.getTable(), statement.getId()); return tr; } else { logger.error("Exception Processing Result: ", new LivyCodeException("Unsupported result type requested of Livy. Results not recognized")); throw new LivyUserException("livy.unsupported_result_type"); } } return transformResponse; } private  LivyRestModelTransformer(); @Nonnull static SparkJobResponse toJobResponse(@Nonnull final String id, @Nonnull final Statement statement); static TransformResponse toTransformResponse(Statement statement, String transformId); static SaveResponse toSaveResponse(Statement statement); static DataSources toDataSources(Statement statement); static URI toUri(Statement statement); static ServerStatusResponse toServerStatusResponse(LivyServer livyServer, Integer sessionId); static Cache<String, Integer> statementIdCache; }### Answer:
@Test public void simpleTestWithSchema() throws IOException { final String json = TestUtils.getTestResourcesFileAsString("dataFrameStatementPostResponseWithSchema.json"); Statement statement = new ObjectMapper().readValue(json, Statement.class); logger.info("response={}", statement); TransformResponse response = LivyRestModelTransformer.toTransformResponse(statement, "testTableName"); assertThat(response).hasFieldOrPropertyWithValue("status", TransformResponse.Status.SUCCESS ); assertThat(response).hasFieldOrPropertyWithValue("progress", 1.0); TransformQueryResult tqr = response.getResults(); assertThat(tqr).isNotNull(); List<QueryResultColumn> cols = tqr.getColumns(); assertThat(cols).isNotNull(); QueryResultColumn dt0 = cols.get(0); assertThat(dt0).hasFieldOrPropertyWithValue("dataType", "integer"); List<Object> row1 = Lists.newArrayList( 1, "Toyota Park", "Bridgeview", "IL", 0, "1527526048390"); assertThat( tqr.getRows() ).contains(row1); }