[build] Apply spotless for java formatting (#1768)

Update checkstyle config to be compatible with spotless.

Co-authored-by: Austin Shalit <austinshalit@gmail.com>
This commit is contained in:
Peter Johnson
2020-12-29 22:45:16 -08:00
committed by GitHub
parent e563a0b7db
commit a751fa22d2
883 changed files with 16526 additions and 17751 deletions

View File

@@ -4,17 +4,6 @@
package edu.wpi.first.networktables;
import java.util.ArrayList;
import java.util.List;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -22,6 +11,16 @@ import static org.junit.jupiter.api.Assertions.assertNotSame;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
import java.util.ArrayList;
import java.util.List;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
class ConnectionListenerTest {
private NetworkTableInstance m_serverInst;
private NetworkTableInstance m_clientInst;
@@ -41,9 +40,7 @@ class ConnectionListenerTest {
m_serverInst.close();
}
/**
* Connect to the server.
*/
/** Connect to the server. */
@SuppressWarnings("PMD.AvoidUsingHardCodedIP")
private void connect() {
m_serverInst.startServer("connectionlistenertest.ini", "127.0.0.1", 10000);
@@ -108,13 +105,12 @@ class ConnectionListenerTest {
assertEquals(1, events.length);
assertEquals(handle, events[0].listener);
assertFalse(events[0].connected);
}
@ParameterizedTest
@DisabledOnOs(OS.WINDOWS)
@SuppressWarnings("PMD.AvoidUsingHardCodedIP")
@ValueSource(strings = { "127.0.0.1", "127.0.0.1 ", " 127.0.0.1 " })
@ValueSource(strings = {"127.0.0.1", "127.0.0.1 ", " 127.0.0.1 "})
void testThreaded(String address) {
m_serverInst.startServer("connectionlistenertest.ini", address, 10000);
List<ConnectionNotification> events = new ArrayList<>();

View File

@@ -4,18 +4,17 @@
package edu.wpi.first.networktables;
import java.util.ArrayList;
import java.util.List;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertAll;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
import java.util.ArrayList;
import java.util.List;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
class EntryListenerTest {
private NetworkTableInstance m_serverInst;
private NetworkTableInstance m_clientInst;
@@ -53,15 +52,12 @@ class EntryListenerTest {
}
}
/**
* Test prefix with a new remote.
*/
/** Test prefix with a new remote. */
@Test
void testPrefixNewRemote() {
connect();
List<EntryNotification> events = new ArrayList<>();
final int handle = m_serverInst.addEntryListener("/foo", events::add,
EntryListenerFlags.kNew);
final int handle = m_serverInst.addEntryListener("/foo", events::add, EntryListenerFlags.kNew);
// Trigger an event
m_clientInst.getEntry("/foo/bar").setDouble(1.0);
@@ -76,13 +72,13 @@ class EntryListenerTest {
assertTrue(m_serverInst.waitForEntryListenerQueue(1.0));
// Check the event
assertAll("Event",
assertAll(
"Event",
() -> assertEquals(1, events.size()),
() -> assertEquals(handle, events.get(0).listener),
() -> assertEquals(m_serverInst.getEntry("/foo/bar"), events.get(0).getEntry()),
() -> assertEquals("/foo/bar", events.get(0).name),
() -> assertEquals(NetworkTableValue.makeDouble(1.0), events.get(0).value),
() -> assertEquals(EntryListenerFlags.kNew, events.get(0).flags)
);
() -> assertEquals(EntryListenerFlags.kNew, events.get(0).flags));
}
}

View File

@@ -4,16 +4,15 @@
package edu.wpi.first.networktables;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.fail;
import java.util.ArrayList;
import java.util.List;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.fail;
class LoggerTest {
private NetworkTableInstance m_clientInst;

View File

@@ -4,24 +4,22 @@
package edu.wpi.first.networktables;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Stream;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import static org.junit.jupiter.api.Assertions.assertEquals;
class NetworkTableTest {
private static Stream<Arguments> basenameKeyArguments() {
return Stream.of(
Arguments.of("simple", "simple"),
Arguments.of("simple", "one/two/many/simple"),
Arguments.of("simple", "//////an/////awful/key////simple")
);
Arguments.of("simple", "//////an/////awful/key////simple"));
}
@ParameterizedTest
@@ -35,8 +33,7 @@ class NetworkTableTest {
Arguments.of("/", "///"),
Arguments.of("/no/normal/req", "/no/normal/req"),
Arguments.of("/no/leading/slash", "no/leading/slash"),
Arguments.of("/what/an/awful/key/", "//////what////an/awful/////key///")
);
Arguments.of("/what/an/awful/key/", "//////what////an/awful/////key///"));
}
@ParameterizedTest
@@ -51,8 +48,7 @@ class NetworkTableTest {
Arguments.of("a", "///a"),
Arguments.of("leading/slash", "/leading/slash"),
Arguments.of("no/leading/slash", "no/leading/slash"),
Arguments.of("what/an/awful/key/", "//////what////an/awful/////key///")
);
Arguments.of("what/an/awful/key/", "//////what////an/awful/////key///"));
}
@ParameterizedTest
@@ -66,8 +62,7 @@ class NetworkTableTest {
Arguments.of(Collections.singletonList("/"), ""),
Arguments.of(Collections.singletonList("/"), "/"),
Arguments.of(Arrays.asList("/", "/foo", "/foo/bar", "/foo/bar/baz"), "/foo/bar/baz"),
Arguments.of(Arrays.asList("/", "/foo", "/foo/bar", "/foo/bar/"), "/foo/bar/")
);
Arguments.of(Arrays.asList("/", "/foo", "/foo/bar", "/foo/bar/"), "/foo/bar/"));
}
@ParameterizedTest