[JAVA-31658] Upgrade cactoos, jcabi-aspects, threetenbp, jodatime (#16293)

This commit is contained in:
vunamtien
2024-04-05 10:49:54 +03:00
committed by GitHub
parent bb544b9168
commit 9ff1e00b0e
11 changed files with 43 additions and 22 deletions
+1 -1
View File
@@ -100,7 +100,7 @@
<javatuples.version>1.2</javatuples.version>
<multiverse.version>0.7.0</multiverse.version>
<chronicle.map.version>3.24ea1</chronicle.map.version>
<cactoos.version>0.43</cactoos.version>
<cactoos.version>0.55.0</cactoos.version>
<cache2k.version>1.2.3.Final</cache2k.version>
<pcollections.version>2.1.2</pcollections.version>
<eclipse-collections.version>8.2.0</eclipse-collections.version>
@@ -3,10 +3,13 @@ package com.baeldung.cactoos;
import java.util.Collection;
import java.util.List;
import org.cactoos.collection.Filtered;
import org.cactoos.func.FuncOf;
import org.cactoos.iterable.Filtered;
import org.cactoos.iterable.IterableOf;
import org.cactoos.iterable.Mapped;
import org.cactoos.list.ListOf;
import org.cactoos.scalar.And;
import org.cactoos.scalar.True;
import org.cactoos.text.FormattedText;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -16,13 +19,24 @@ public class CactoosCollectionUtils {
final Logger LOGGER = LoggerFactory.getLogger(CactoosCollectionUtils.class);
public void iterateCollection(List<String> strings) throws Exception {
new And((String input) -> LOGGER.info(new FormattedText("%s\n", input).asString()), strings).value();
new And(
new Mapped<>(
new FuncOf<>(
input -> System.out.printf("Item: %s\n", input),
new True()
),
strings
)
).value();
}
public Collection<String> getFilteredList(List<String> strings) {
Collection<String> filteredStrings = new ListOf<>(
new Filtered<>(string -> string.length() == 5, new IterableOf<>(strings)));
return filteredStrings;
return new ListOf<>(
new Filtered<>(
s -> s.length() == 5,
strings
)
);
}
}
@@ -10,17 +10,17 @@ import org.cactoos.text.Upper;
public class CactoosStringUtils {
public String createString() throws IOException {
public String createString() throws Exception {
String testString = new TextOf("Test String").asString();
return testString;
}
public String createdFormattedString(String stringToFormat) throws IOException {
public String createdFormattedString(String stringToFormat) throws Exception {
String formattedString = new FormattedText("Hello %s", stringToFormat).asString();
return formattedString;
}
public String toLowerCase(String testString) throws IOException {
public String toLowerCase(String testString) throws Exception {
String lowerCaseString = new Lowered(new TextOf(testString)).asString();
return lowerCaseString;
}
@@ -9,7 +9,7 @@ import org.junit.Test;
public class CactoosStringUtilsUnitTest {
@Test
public void whenFormattedTextIsPassedWithArgs_thenFormattedStringIsReturned() throws IOException {
public void whenFormattedTextIsPassedWithArgs_thenFormattedStringIsReturned() throws Exception {
CactoosStringUtils obj = new CactoosStringUtils();