test_class.declarator: logger = LoggerFactory.getLogger(HtmlSchemaParserTest.class)
test_class.modifier: private final static
test_class.original_string: private final static Logger logger = LoggerFactory.getLogger(HtmlSchemaParserTest.class);
test_class.type: Logger
test_class.var_name: logger
test_class.declarator: HEADER_SELECTOR = "html body table tr th"
test_class.modifier: private static final
test_class.original_string: private static final String HEADER_SELECTOR = "html body table tr th";
test_class.type: String
test_class.var_name: HEADER_SELECTOR
test_class.declarator: VALUES_SELECTOR = "html body table tr td"
test_class.modifier: private static final
test_class.original_string: private static final String VALUES_SELECTOR = "html body table tr td";
test_class.type: String
test_class.var_name: VALUES_SELECTOR
test_class.declarator: parser
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private HtmlSchemaParser parser;
test_class.type: HtmlSchemaParser
test_class.var_name: parser
test_class.declarator: serializer
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private HtmlSerializer serializer;
test_class.type: HtmlSerializer
test_class.var_name: serializer
test_class.declarator: htmlFormatFamily
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private HtmlFormatFamily htmlFormatFamily;
test_class.type: HtmlFormatFamily
test_class.var_name: htmlFormatFamily
test_class.declarator: unsupportedFormatFamily
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private UnsupportedFormatFamily unsupportedFormatFamily;
test_class.type: UnsupportedFormatFamily
test_class.var_name: unsupportedFormatFamily
test_class.file: dataprep-backend-service/src/test/java/org/talend/dataprep/schema/html/HtmlSchemaParserTest.java
test_class.identifier: HtmlSchemaParserTest
test_class.superclass: extends AbstractSchemaTestUtils
test_case.body: @Test
      public void read_html_TDP_1136() throws Exception {
  
          try (InputStream inputStream = this.getClass().getResourceAsStream("sales-force.xls")) {
              // We do know the format and therefore we go directly to the HTML schema guessing
              SchemaParser.Request request = getRequest(inputStream, "#1");
              request.getMetadata().setEncoding("UTF-16");
  
              Schema result = parser.parse(request);
              Assertions.assertThat(result).isNotNull();
              Assertions.assertThat(result.getSheetContents()).isNotNull().isNotEmpty().hasSize(1);
              List<ColumnMetadata> columnMetadatas = result.getSheetContents().get(0).getColumnMetadatas();
              Assertions.assertThat(columnMetadatas).isNotNull().isNotEmpty().hasSize(7);
  
              Assertions
                      .assertThat(columnMetadatas.get(0)) //
                      .isEqualToComparingOnlyGivenFields(
                              ColumnMetadata.Builder
                                      .column() //
                                      .type(Type.STRING)
                                      .id(0)
                                      .name("UID")
                                      .build(), //
                              "id", "name", "type");
  
              Assertions
                      .assertThat(columnMetadatas.get(1)) //
                      .isEqualToComparingOnlyGivenFields(
                              ColumnMetadata.Builder
                                      .column() //
                                      .type(Type.STRING)
                                      .id(1)
                                      .name("Team Member: Name")
                                      .build(), //
                              "id", "name", "type");
  
              Assertions
                      .assertThat(columnMetadatas.get(2)) //
                      .isEqualToComparingOnlyGivenFields(
                              ColumnMetadata.Builder
                                      .column() //
                                      .type(Type.STRING)
                                      .id(2)
                                      .name("Country")
                                      .build(), //
                              "id", "name", "type");
          }
      }
test_case.class_method_signature: HtmlSchemaParserTest.read_html_TDP_1136()
test_case.full_signature: @Test public void read_html_TDP_1136()
test_case.identifier: read_html_TDP_1136
test_case.invocations: getResourceAsStream getClass getRequest setEncoding getMetadata parse isNotNull assertThat hasSize isNotEmpty isNotNull assertThat getSheetContents getColumnMetadatas get getSheetContents hasSize isNotEmpty isNotNull assertThat isEqualToComparingOnlyGivenFields assertThat get build name id type column isEqualToComparingOnlyGivenFields assertThat get build name id type column isEqualToComparingOnlyGivenFields assertThat get build name id type column
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void read_html_TDP_1136()
focal_class.declarator: LOGGER = LoggerFactory.getLogger(HtmlSchemaParser.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = LoggerFactory.getLogger(HtmlSchemaParser.class);
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.file: dataprep-backend-service/src/main/java/org/talend/dataprep/schema/html/HtmlSchemaParser.java
focal_class.identifier: HtmlSchemaParser
focal_class.interfaces: implements SchemaParser
focal_class.class_method_signature: HtmlSchemaParser.parse(Request request)
focal_class.full_signature: @Override public Schema parse(Request request)
focal_class.identifier: parse
focal_class.modifiers: @Override public
focal_class.parameters: (Request request)
focal_class.return: Schema
focal_class.signature: Schema parse(Request request)
focal_method.body: @Override
      public Schema parse(Request request) {
  
          try {
              SimpleHeadersContentHandler headersContentHandler = new SimpleHeadersContentHandler();
  
              InputStream inputStream = request.getContent();
              HtmlParser htmlParser = new HtmlParser();
  
              Metadata metadata = new Metadata();
  
              htmlParser.parse(inputStream, headersContentHandler, metadata, new ParseContext());
  
              List<ColumnMetadata> columns = new ArrayList<>(headersContentHandler.getHeaderValues().size());
  
              for (String headerValue : headersContentHandler.getHeaderValues()) {
                  columns.add(ColumnMetadata.Builder
                          .column() //
                          .type(Type.STRING) // ATM not doing any complicated type calculation
                          .name(headerValue) //
                          .id(columns.size()) //
                          .build());
              }
  
              Schema.SheetContent sheetContent = new Schema.SheetContent();
              sheetContent.setColumnMetadatas(columns);
  
              return Schema.Builder
                      .parserResult() //
                      .sheetContents(Collections.singletonList(sheetContent)) //
                      .draft(false) //
                      .build();
  
          } catch (Exception e) {
              LOGGER.debug("Exception during parsing html request :" + e.getMessage(), e);
              throw new TDPException(CommonErrorCodes.UNEXPECTED_EXCEPTION, e);
          }
  
      }
focal_method.class_method_signature: HtmlSchemaParser.parse(Request request)
focal_method.full_signature: @Override public Schema parse(Request request)
focal_method.identifier: parse
focal_method.invocations: getContent parse size getHeaderValues getHeaderValues add build id name type column size setColumnMetadatas build draft sheetContents parserResult singletonList debug getMessage
focal_method.modifiers: @Override public
focal_method.parameters: (Request request)
focal_method.return: Schema
focal_method.signature: Schema parse(Request request)