@Test public void testComputeAnswerMetadataInapplicable() { String columnName = "col"; List<Integer> value = ImmutableList.of(5); Answer testAnswer = new Answer(); testAnswer.addAnswerElement( new TableAnswerElement( new TableMetadata( ImmutableList.of( new ColumnMetadata(columnName, Schema.list(Schema.INTEGER), "foobar")), new DisplayHints().getTextDesc())) .addRow(Row.of(columnName, value))); testAnswer.setStatus(AnswerStatus.SUCCESS); assertThat( AnswerMetadataUtil.computeAnswerMetadata(testAnswer, _logger), equalTo( AnswerMetadata.builder() .setMetrics(Metrics.builder().setNumRows(1).build()) .setStatus(AnswerStatus.SUCCESS) .build())); }
public static @Nonnull AnswerMetadata computeAnswerMetadata( @Nonnull Answer answer, @Nonnull BatfishLogger logger) { try { return AnswerMetadata.builder() .setMetrics(computeMetrics(answer, logger)) .setStatus(answer.getStatus()) .build(); } catch (Exception e) { return AnswerMetadata.forStatus(AnswerStatus.FAILURE); } }
AnswerMetadataUtil { public static @Nonnull AnswerMetadata computeAnswerMetadata( @Nonnull Answer answer, @Nonnull BatfishLogger logger) { try { return AnswerMetadata.builder() .setMetrics(computeMetrics(answer, logger)) .setStatus(answer.getStatus()) .build(); } catch (Exception e) { return AnswerMetadata.forStatus(AnswerStatus.FAILURE); } } }
AnswerMetadataUtil { public static @Nonnull AnswerMetadata computeAnswerMetadata( @Nonnull Answer answer, @Nonnull BatfishLogger logger) { try { return AnswerMetadata.builder() .setMetrics(computeMetrics(answer, logger)) .setStatus(answer.getStatus()) .build(); } catch (Exception e) { return AnswerMetadata.forStatus(AnswerStatus.FAILURE); } } private  AnswerMetadataUtil(); }
AnswerMetadataUtil { public static @Nonnull AnswerMetadata computeAnswerMetadata( @Nonnull Answer answer, @Nonnull BatfishLogger logger) { try { return AnswerMetadata.builder() .setMetrics(computeMetrics(answer, logger)) .setStatus(answer.getStatus()) .build(); } catch (Exception e) { return AnswerMetadata.forStatus(AnswerStatus.FAILURE); } } private  AnswerMetadataUtil(); static @Nonnull AnswerMetadata computeAnswerMetadata(
      @Nonnull Answer answer, @Nonnull BatfishLogger logger); }
AnswerMetadataUtil { public static @Nonnull AnswerMetadata computeAnswerMetadata( @Nonnull Answer answer, @Nonnull BatfishLogger logger) { try { return AnswerMetadata.builder() .setMetrics(computeMetrics(answer, logger)) .setStatus(answer.getStatus()) .build(); } catch (Exception e) { return AnswerMetadata.forStatus(AnswerStatus.FAILURE); } } private  AnswerMetadataUtil(); static @Nonnull AnswerMetadata computeAnswerMetadata(
      @Nonnull Answer answer, @Nonnull BatfishLogger logger);  }