Map::entry is not available in Java 8.

This commit is contained in:
tomasz.kowalczewski committed 2021-04-22 21:22:15 +02:00
1 parent c9a71cd423
commit b91bc54dfd
2 files changed
+13 -15

No files matched your search

@@ -1,6 +1,5 @@
package pl.tkowalcz.tjahzi.logback;
import java.util.Map;
import java.util.regex.Pattern;
public class Label {
@@ -39,11 +38,6 @@ public class Label {
this.value = value;
}
// @VisibleForTests
public Map.Entry<String, String> asEntry() {
return Map.entry(getName(), getValue());
}
public static boolean hasValidName(String label) {
return LABEL_NAME_PATTER.matcher(label).matches();
}
@@ -30,8 +30,8 @@ class LabelFactoryTest {
// Then
assertThat(actual).containsOnly(
thisShouldStay.asEntry(),
thisTooShouldStay.asEntry()
asEntry(thisShouldStay),
asEntry(thisTooShouldStay)
);
}
@@ -55,8 +55,8 @@ class LabelFactoryTest {
// Then
assertThat(actual).containsOnly(
thisShouldStay.asEntry(),
thisShouldStayToo.asEntry()
asEntry(thisShouldStay),
asEntry(thisShouldStayToo)
);
}
@@ -78,8 +78,8 @@ class LabelFactoryTest {
// Then
assertThat(actual).containsOnly(
label1.asEntry(),
label2.asEntry()
asEntry(label1),
asEntry(label2)
);
}
@@ -100,8 +100,8 @@ class LabelFactoryTest {
HashMap<String, String> labels = new HashMap<>(
Map.ofEntries(
thisShouldStay.asEntry(),
thisShouldBeRemovedDueToConflict.asEntry()
asEntry(thisShouldStay),
asEntry(thisShouldBeRemovedDueToConflict)
)
);
@@ -110,7 +110,7 @@ class LabelFactoryTest {
// Then
assertThat(labels).containsOnly(
thisShouldStay.asEntry()
asEntry(thisShouldStay)
);
assertThat(actual).isEqualTo(logLevelLabel);
@@ -142,4 +142,8 @@ class LabelFactoryTest {
// Then
assertThat(actual).isNull();
}
public Map.Entry<String, String> asEntry(Label label) {
return Map.entry(label.getName(), label.getValue());
}
}