mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-02-02 05:21:36 +01:00
Fixed some new code smells
- Files.isDirectory call apparently slow - Unused private method removed in WorldPie - Replaced OptionalAssert with Assertions.assertEquals
This commit is contained in:
parent
32ccc6ac7f
commit
0ccf7678c4
@ -79,24 +79,4 @@ public class WorldPie extends PieWithDrilldown {
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
private void appendGMTimesForWorld(StringBuilder drilldownBuilder, Map.Entry<String, GMTimes> world) {
|
||||
Map<String, Long> gmTimes = world.getValue().getTimes();
|
||||
int smallSize = gmTimes.size();
|
||||
int j = 0;
|
||||
for (Map.Entry<String, Long> entry : gmTimes.entrySet()) {
|
||||
Long time = entry.getValue();
|
||||
drilldownBuilder.append("['")
|
||||
.append(entry.getKey())
|
||||
.append("',")
|
||||
.append(time)
|
||||
.append("]");
|
||||
|
||||
if (j < smallSize - 1) {
|
||||
drilldownBuilder.append(",");
|
||||
}
|
||||
j++;
|
||||
}
|
||||
drilldownBuilder.append("]}");
|
||||
}
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ public class ConfigWriter {
|
||||
writing.updateParent(null);
|
||||
|
||||
Path directory = outputPath.getParent();
|
||||
if (!Files.isDirectory(directory.toRealPath())) {
|
||||
if (!directory.toRealPath().toFile().isDirectory()) {
|
||||
Files.createDirectories(directory);
|
||||
}
|
||||
Files.write(outputPath, parseLines(writing), StandardCharsets.UTF_8, StandardOpenOption.TRUNCATE_EXISTING, StandardOpenOption.CREATE);
|
||||
|
@ -19,10 +19,11 @@ package com.djrapitops.plan.identification;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.platform.runner.JUnitPlatform;
|
||||
import org.junit.runner.RunWith;
|
||||
import utilities.OptionalAssert;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
/**
|
||||
* Tests for {@link UUIDUtility}.
|
||||
*
|
||||
@ -34,6 +35,6 @@ class UUIDUtilityTest {
|
||||
@Test
|
||||
void stringUUIDIsParsed() {
|
||||
String test = "f3cc3e96-1bc9-35ad-994f-d894e9764b93";
|
||||
OptionalAssert.equals(UUID.fromString(test), UUIDUtility.parseFromString(test));
|
||||
assertEquals(UUID.fromString(test), UUIDUtility.parseFromString(test).orElse(null));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user