use of org.cactoos.text.SubText in project cactoos by yegor256.
the class SolidMapTest method mapsEmptyIterableWithKeyFuncAndValueFunc.
@Test
public void mapsEmptyIterableWithKeyFuncAndValueFunc() {
final SolidMap<String, String> map = new SolidMap<>(key -> new SubText(new TextOf(key), 0, 1).asString(), value -> new UpperText(new TextOf(value)).asString(), new IterableOf<String>());
MatcherAssert.assertThat("Empty Iterable cannot be accepted for key and value mapping", map, new MatcherOf<>(m -> m.size() == 0));
}
use of org.cactoos.text.SubText in project cactoos by yegor256.
the class SolidMapTest method mapsIterableWithKeyFuncAndValueFunc.
@Test
public void mapsIterableWithKeyFuncAndValueFunc() {
final SolidMap<String, String> map = new SolidMap<>(key -> new SubText(new TextOf(key), 0, 1).asString(), value -> new UpperText(new TextOf(value)).asString(), new IterableOf<>("aa", "bb"));
MatcherAssert.assertThat("Functions are not applied to key and value", map, Matchers.allOf(Matchers.hasEntry(Matchers.equalTo("a"), Matchers.equalTo("AA")), Matchers.hasEntry(Matchers.equalTo("b"), Matchers.equalTo("BB")), new MatcherOf<>(m -> m.size() == 2)));
}
Aggregations