Skip to content

Commit

Permalink
Fixed sonar warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
javadev authored Dec 20, 2024
1 parent 9282c4d commit b86d4e1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
5 changes: 2 additions & 3 deletions src/test/java/com/github/underscore/LodashTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,7 @@ void set() {
U.<String>set(
(Map<String, Object>) U.fromJson("{\"a\":[{\"b\":{\"c\":\"d\"}}]}"),
"a[0].b.c",
"e")
.toString());
"e"));
assertEquals(
"{b={c=d}}",
U.set(
Expand All @@ -428,7 +427,7 @@ void set() {
map.put("a", map2);
map2.put("#item", map3);
map3.put("b", "c");
assertEquals("c", U.<String>set(map, "a.b", "b").toString());
assertEquals("c", U.<String>set(map, "a.b", "b"));
assertNull(U.<String>set((Map<String, Object>) null, "a", "b"));
assertNull(U.<String>set(new LinkedHashMap<String, Object>(), "a.b", "b"));
Map<String, Object> map4 = new LinkedHashMap<>();
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/com/github/underscore/ObjectsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ void pick() {
put("userid", "moe1");
}
},
value -> value instanceof Number);
Number.class::isInstance);
assertEquals("[age=50]", result2.toString());
}

Expand Down Expand Up @@ -208,7 +208,7 @@ void omit() {
put("userid", "moe1");
}
},
value -> value instanceof Number);
Number.class::isInstance);
assertEquals("[name=moe, userid=moe1]", result2.toString());
}

Expand Down
8 changes: 4 additions & 4 deletions src/test/java/com/github/underscore/UnderscoreTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,9 @@ void push() {
@SuppressWarnings("unchecked")
@Test
void pop() {
assertEquals("c", Underscore.pop(asList("a", "b", "c")).getKey().toString());
assertEquals("c", Underscore.pop(asList("a", "b", "c")).getKey());
assertEquals("c", new Underscore(asList("a", "b", "c")).pop().getKey().toString());
assertEquals("c", Underscore.chain(asList("a", "b", "c")).pop().item().getKey().toString());
assertEquals("c", Underscore.chain(asList("a", "b", "c")).pop().item().getKey());
}

/*
Expand All @@ -178,7 +178,7 @@ void pop() {
@SuppressWarnings("unchecked")
@Test
void shift() {
assertEquals("a", Underscore.shift(asList("a", "b", "c")).getKey().toString());
assertEquals("a", Underscore.shift(asList("a", "b", "c")).getKey());
assertEquals("a", new Underscore(asList("a", "b", "c")).shift().getKey().toString());
assertEquals(
"a", Underscore.chain(asList("a", "b", "c")).shift().item().getKey().toString());
Expand Down Expand Up @@ -541,7 +541,7 @@ void optional() {
assertEquals("1", Optional.of(1).orElse(null).toString());
assertFalse(Optional.<Integer>empty().map(arg -> "" + arg).isPresent());
assertTrue(Optional.<Integer>empty().map(arg -> "" + arg).isEmpty());
assertEquals("1", Optional.of(1).map(arg -> "" + arg).get().toString());
assertEquals("1", Optional.of(1).map(arg -> "" + arg).get());
try {
Optional.empty().get();
fail("IllegalStateException expected");
Expand Down

0 comments on commit b86d4e1

Please sign in to comment.