File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
main/java/ru/mystamps/web/feature/series/importing/extractor Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -216,6 +216,10 @@ protected String extractPrice(Element body) {
216216 }
217217
218218 String price = elem .ownText ();
219+ if (StringUtils .isBlank (price )) {
220+ price = elem .text ();
221+ }
222+
219223 LOG .debug ("Extracted price: '{}'" , price );
220224 return price ;
221225 }
Original file line number Diff line number Diff line change @@ -648,6 +648,24 @@ public void extractPriceShouldIgnoreTextOfChildrenTags() {
648648 .isEqualTo (expectedValue );
649649 }
650650
651+ @ Test
652+ public void extractPriceShouldFallbackToTextOfChildrenTags () {
653+ parser .setPriceLocator ("#price" );
654+
655+ String expectedPrice = String .valueOf (Random .price ());
656+ String expectedValue = "price:" + expectedPrice ;
657+ String html = String .format (
658+ "<span id='price'><b>price:</b><b>%s</b></span>" ,
659+ expectedPrice
660+ );
661+ Element doc = createDocumentFromText (html );
662+
663+ String price = parser .extractPrice (doc );
664+
665+ assertThat (price ).as ("couldn't extract price from '%s'" , doc )
666+ .isEqualTo (expectedValue );
667+ }
668+
651669 //
652670 // Tests for extractCurrency()
653671 //
You can’t perform that action at this time.
0 commit comments