Skip to content

Commit 84897e6

Browse files
authored
Fixed Sonar warnings
1 parent 605112c commit 84897e6

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

src/test/java/com/github/underscore/CollectionsTest.java

+10-11
Original file line numberDiff line numberDiff line change
@@ -1301,26 +1301,25 @@ void sortWith() {
13011301
Underscore.sortWith(
13021302
asList(1, 2, 3, 4, 5, 6),
13031303
(item1, item2) ->
1304-
Double.valueOf(Math.sin(item1) * 1000).intValue()
1305-
- Double.valueOf(Math.sin(item2) * 1000).intValue());
1304+
(int) (Math.sin(item1) * 1000)
1305+
- (int) (Math.sin(item2) * 1000));
13061306
assertEquals("[5, 4, 6, 3, 1, 2]", result.toString());
13071307
final List<Integer> resultObj =
13081308
new Underscore(asList(1, 2, 3, 4, 5, 6))
13091309
.sortWith(
13101310
(Comparator<Integer>)
13111311
(item1, item2) ->
1312-
Double.valueOf(Math.sin(item1) * 1000).intValue()
1313-
- Double.valueOf(Math.sin(item2) * 1000)
1314-
.intValue());
1312+
(int) (Math.sin(item1) * 1000)
1313+
- (int) (Math.sin(item2) * 1000));
13151314
assertEquals("[5, 4, 6, 3, 1, 2]", resultObj.toString());
13161315
final List<Integer> resultChain =
13171316
Underscore.chain(asList(1, 2, 3, 4, 5, 6))
13181317
.sortWith(
13191318
(Comparator<Integer>)
13201319
(item1, item2) ->
1321-
Double.valueOf(Math.sin(item1) * 1000).intValue()
1322-
- Double.valueOf(Math.sin(item2) * 1000)
1323-
.intValue())
1320+
(int) (Math.sin(item1) * 1000)
1321+
- (int) (Math.sin(item2) * 1000)
1322+
)
13241323
.value();
13251324
assertEquals("[5, 4, 6, 3, 1, 2]", resultChain.toString());
13261325
}
@@ -1335,17 +1334,17 @@ void sortBy() {
13351334
final List<Integer> result =
13361335
Underscore.sortBy(
13371336
asList(1, 2, 3, 4, 5, 6),
1338-
item -> Double.valueOf(Math.sin(item) * 1000).intValue());
1337+
item -> (int) (Math.sin(item) * 1000));
13391338
assertEquals("[5, 4, 6, 3, 1, 2]", result.toString());
13401339
final List<Integer> resultObj =
13411340
new Underscore(asList(1, 2, 3, 4, 5, 6))
13421341
.sortBy(
13431342
(Function<Integer, Integer>)
1344-
item -> Double.valueOf(Math.sin(item) * 1000).intValue());
1343+
item -> (int) (Math.sin(item) * 1000));
13451344
assertEquals("[5, 4, 6, 3, 1, 2]", resultObj.toString());
13461345
final List<Integer> resultChain =
13471346
Underscore.chain(asList(1, 2, 3, 4, 5, 6))
1348-
.sortBy(item -> Double.valueOf(Math.sin(item) * 1000).intValue())
1347+
.sortBy(item -> (int) (Math.sin(item) * 1000))
13491348
.value();
13501349
assertEquals("[5, 4, 6, 3, 1, 2]", resultChain.toString());
13511350
}

0 commit comments

Comments
 (0)