File tree 2 files changed +23
-1
lines changed
main/java/ru/mystamps/web/util/extractor
2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -282,7 +282,6 @@ protected String extractPrice(Element body) {
282
282
return price ;
283
283
}
284
284
285
- // @todo #695 JsoupSiteParser.extractCurrency(): add unit tests
286
285
protected String extractCurrency (Element body ) {
287
286
if (currencyValue == null ) {
288
287
return null ;
Original file line number Diff line number Diff line change @@ -863,6 +863,29 @@ public void extractPriceShouldReturnTextOfPriceLocator() {
863
863
assertThat (msg , price , equalTo (expectedValue ));
864
864
}
865
865
866
+ //
867
+ // Tests for extractCurrency()
868
+ //
869
+
870
+ @ Test
871
+ public void extractCurrencyShouldReturnNullWhenCurrencyValueIsNotSet () {
872
+ parser .setCurrencyValue (null );
873
+
874
+ String currency = parser .extractCurrency (null );
875
+
876
+ assertThat (currency , is (nullValue ()));
877
+ }
878
+
879
+ @ Test
880
+ public void extractCurrencyShouldReturnCurrencyValue () {
881
+ String expectedCurrency = Random .currency ().toString ();
882
+ parser .setCurrencyValue (expectedCurrency );
883
+
884
+ String currency = parser .extractCurrency (null );
885
+
886
+ assertThat (currency , equalTo (expectedCurrency ));
887
+ }
888
+
866
889
private static String describe (JsoupSiteParser parser ) {
867
890
StringBuilder sb = new StringBuilder ();
868
891
sb .append ("JsoupSiteParser[name=" )
You can’t perform that action at this time.
0 commit comments