Skip to content

Commit

Permalink
Formatting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
srimanachanta committed Oct 13, 2023
1 parent 1992d6d commit c3559ad
Show file tree
Hide file tree
Showing 282 changed files with 582 additions and 753 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import edu.wpi.first.cscore.*;
import edu.wpi.first.cscore.VideoMode.PixelFormat;
import edu.wpi.first.networktables.*;

import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
package edu.wpi.first.cscore;

import edu.wpi.first.util.RuntimeLoader;
import org.opencv.core.Core;

import java.io.IOException;
import java.util.concurrent.atomic.AtomicBoolean;
import org.opencv.core.Core;

public class CameraServerCvJNI {
static boolean libraryLoaded = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import edu.wpi.first.cscore.raw.RawFrame;
import edu.wpi.first.util.RuntimeLoader;

import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.concurrent.atomic.AtomicBoolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package edu.wpi.first.cscore.raw;

import edu.wpi.first.cscore.CameraServerJNI;

import java.nio.ByteBuffer;

/**
Expand Down
11 changes: 5 additions & 6 deletions cscore/src/test/java/edu/wpi/first/cscore/UsbCameraTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,17 @@

package edu.wpi.first.cscore;

import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledOnOs;
import org.junit.jupiter.api.condition.OS;
import static org.junit.jupiter.api.Assertions.*;

import java.time.Duration;
import java.util.Arrays;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledOnOs;
import org.junit.jupiter.api.condition.OS;

class UsbCameraTest {
@Nested
Expand Down
4 changes: 2 additions & 2 deletions cscore/src/test/java/edu/wpi/first/cscore/VideoModeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

package edu.wpi.first.cscore;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;

import org.junit.jupiter.api.Test;

class VideoModeTest {
@Test
void equalityTest() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,18 @@

package edu.wpi.first.networktables;

import static org.junit.jupiter.api.Assertions.*;

import edu.wpi.first.util.WPIUtilJNI;
import java.util.ArrayList;
import java.util.EnumSet;
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.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;

import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;

import static org.junit.jupiter.api.Assertions.*;

class ConnectionListenerTest {
private NetworkTableInstance m_serverInst;
private NetworkTableInstance m_clientInst;
Expand Down
11 changes: 5 additions & 6 deletions ntcore/src/test/java/edu/wpi/first/networktables/LoggerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@

package edu.wpi.first.networktables;

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;

import java.util.ArrayList;
import java.util.List;

import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.fail;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

class LoggerTest {
private NetworkTableInstance m_clientInst;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@

package edu.wpi.first.networktables;

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;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Stream;

import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;

class NetworkTableTest {
private static Stream<Arguments> basenameKeyArguments() {
Expand Down
49 changes: 24 additions & 25 deletions ntcore/src/test/java/edu/wpi/first/networktables/RawTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@

package edu.wpi.first.networktables;

import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;

import java.nio.ByteBuffer;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import java.nio.ByteBuffer;

import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;

@SuppressWarnings("PMD.SimplifiableTestAssertion")
class RawTest {
private NetworkTableInstance m_inst;
Expand All @@ -31,9 +30,9 @@ void tearDown() {
void testGenericByteArray() {
GenericEntry entry = m_inst.getTopic("test").getGenericEntry("raw");
entry.setRaw(new byte[] {5}, 10);
assertArrayEquals(entry.getRaw(new byte[]{}), new byte[]{5});
assertArrayEquals(entry.getRaw(new byte[] {}), new byte[] {5});
entry.setRaw(new byte[] {5, 6, 7}, 1, 2, 15);
assertArrayEquals(entry.getRaw(new byte[]{}), new byte[]{6, 7});
assertArrayEquals(entry.getRaw(new byte[] {}), new byte[] {6, 7});
assertThrows(IndexOutOfBoundsException.class, () -> entry.setRaw(new byte[] {5}, -1, 2, 20));
assertThrows(IndexOutOfBoundsException.class, () -> entry.setRaw(new byte[] {5}, 1, -2, 20));
assertThrows(IndexOutOfBoundsException.class, () -> entry.setRaw(new byte[] {5}, 1, 1, 20));
Expand All @@ -43,9 +42,9 @@ void testGenericByteArray() {
void testRawByteArray() {
RawEntry entry = m_inst.getRawTopic("test").getEntry("raw", new byte[] {});
entry.set(new byte[] {5}, 10);
assertArrayEquals(entry.get(new byte[]{}), new byte[]{5});
assertArrayEquals(entry.get(new byte[] {}), new byte[] {5});
entry.set(new byte[] {5, 6, 7}, 1, 2, 15);
assertArrayEquals(entry.get(new byte[]{}), new byte[]{6, 7});
assertArrayEquals(entry.get(new byte[] {}), new byte[] {6, 7});
assertThrows(IndexOutOfBoundsException.class, () -> entry.set(new byte[] {5}, -1, 1, 20));
assertThrows(IndexOutOfBoundsException.class, () -> entry.set(new byte[] {5}, 1, -1, 20));
assertThrows(IndexOutOfBoundsException.class, () -> entry.set(new byte[] {5}, 1, 1, 20));
Expand All @@ -55,15 +54,15 @@ void testRawByteArray() {
void testGenericByteBuffer() {
GenericEntry entry = m_inst.getTopic("test").getGenericEntry("raw");
entry.setRaw(ByteBuffer.wrap(new byte[] {5}), 10);
assertArrayEquals(entry.getRaw(new byte[]{}), new byte[]{5});
assertArrayEquals(entry.getRaw(new byte[] {}), new byte[] {5});
entry.setRaw(ByteBuffer.wrap(new byte[] {5, 6, 7}).position(1), 15);
assertArrayEquals(entry.getRaw(new byte[]{}), new byte[]{6, 7});
assertArrayEquals(entry.getRaw(new byte[] {}), new byte[] {6, 7});
entry.setRaw(ByteBuffer.wrap(new byte[] {5, 6, 7}).position(1).limit(2), 16);
assertArrayEquals(entry.getRaw(new byte[]{}), new byte[]{6});
assertArrayEquals(entry.getRaw(new byte[] {}), new byte[] {6});
entry.setRaw(ByteBuffer.wrap(new byte[] {8, 9, 0}), 1, 2, 20);
assertArrayEquals(entry.getRaw(new byte[]{}), new byte[]{9, 0});
assertArrayEquals(entry.getRaw(new byte[] {}), new byte[] {9, 0});
entry.setRaw(ByteBuffer.wrap(new byte[] {1, 2, 3}).position(2), 0, 2, 25);
assertArrayEquals(entry.getRaw(new byte[]{}), new byte[]{1, 2});
assertArrayEquals(entry.getRaw(new byte[] {}), new byte[] {1, 2});
assertThrows(
IndexOutOfBoundsException.class,
() -> entry.setRaw(ByteBuffer.wrap(new byte[] {5}), -1, 1, 30));
Expand All @@ -79,15 +78,15 @@ void testGenericByteBuffer() {
void testRawByteBuffer() {
RawEntry entry = m_inst.getRawTopic("test").getEntry("raw", new byte[] {});
entry.set(ByteBuffer.wrap(new byte[] {5}), 10);
assertArrayEquals(entry.get(new byte[]{}), new byte[]{5});
assertArrayEquals(entry.get(new byte[] {}), new byte[] {5});
entry.set(ByteBuffer.wrap(new byte[] {5, 6, 7}).position(1), 15);
assertArrayEquals(entry.get(new byte[]{}), new byte[]{6, 7});
assertArrayEquals(entry.get(new byte[] {}), new byte[] {6, 7});
entry.set(ByteBuffer.wrap(new byte[] {5, 6, 7}).position(1).limit(2), 16);
assertArrayEquals(entry.get(new byte[]{}), new byte[]{6});
assertArrayEquals(entry.get(new byte[] {}), new byte[] {6});
entry.set(ByteBuffer.wrap(new byte[] {8, 9, 0}), 1, 2, 20);
assertArrayEquals(entry.get(new byte[]{}), new byte[]{9, 0});
assertArrayEquals(entry.get(new byte[] {}), new byte[] {9, 0});
entry.set(ByteBuffer.wrap(new byte[] {1, 2, 3}).position(2), 0, 2, 25);
assertArrayEquals(entry.get(new byte[]{}), new byte[]{1, 2});
assertArrayEquals(entry.get(new byte[] {}), new byte[] {1, 2});
assertThrows(
IndexOutOfBoundsException.class,
() -> entry.set(ByteBuffer.wrap(new byte[] {5}), -1, 1, 30));
Expand All @@ -105,13 +104,13 @@ void testGenericNativeByteBuffer() {
ByteBuffer bb = ByteBuffer.allocateDirect(3);
bb.put(new byte[] {5, 6, 7});
entry.setRaw(bb.position(1), 15);
assertArrayEquals(entry.getRaw(new byte[]{}), new byte[]{6, 7});
assertArrayEquals(entry.getRaw(new byte[] {}), new byte[] {6, 7});
entry.setRaw(bb.limit(2), 16);
assertArrayEquals(entry.getRaw(new byte[]{}), new byte[]{6});
assertArrayEquals(entry.getRaw(new byte[] {}), new byte[] {6});
bb.clear();
bb.put(new byte[] {8, 9, 0});
entry.setRaw(bb, 1, 2, 20);
assertArrayEquals(entry.getRaw(new byte[]{}), new byte[]{9, 0});
assertArrayEquals(entry.getRaw(new byte[] {}), new byte[] {9, 0});
assertThrows(IndexOutOfBoundsException.class, () -> entry.setRaw(bb, -1, 1, 25));
assertThrows(IndexOutOfBoundsException.class, () -> entry.setRaw(bb, 1, -1, 25));
assertThrows(IndexOutOfBoundsException.class, () -> entry.setRaw(bb, 2, 2, 25));
Expand All @@ -123,13 +122,13 @@ void testRawNativeByteBuffer() {
ByteBuffer bb = ByteBuffer.allocateDirect(3);
bb.put(new byte[] {5, 6, 7});
entry.set(bb.position(1), 15);
assertArrayEquals(entry.get(new byte[]{}), new byte[]{6, 7});
assertArrayEquals(entry.get(new byte[] {}), new byte[] {6, 7});
entry.set(bb.limit(2), 16);
assertArrayEquals(entry.get(new byte[]{}), new byte[]{6});
assertArrayEquals(entry.get(new byte[] {}), new byte[] {6});
bb.clear();
bb.put(new byte[] {8, 9, 0});
entry.set(bb, 1, 2, 20);
assertArrayEquals(entry.get(new byte[]{}), new byte[]{9, 0});
assertArrayEquals(entry.get(new byte[] {}), new byte[] {9, 0});
assertThrows(IndexOutOfBoundsException.class, () -> entry.set(bb, -1, 1, 25));
assertThrows(IndexOutOfBoundsException.class, () -> entry.set(bb, 1, -1, 25));
assertThrows(IndexOutOfBoundsException.class, () -> entry.set(bb, 2, 2, 25));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@

package edu.wpi.first.networktables;

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.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.util.EnumSet;
import java.util.concurrent.atomic.AtomicInteger;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

class TableListenerTest {
private NetworkTableInstance m_inst;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

package edu.wpi.first.networktables;

import static org.junit.jupiter.api.Assertions.*;

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.*;

class TimeSyncTest {
private NetworkTableInstance m_inst;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@

package edu.wpi.first.networktables;

import static org.junit.jupiter.api.Assertions.*;

import edu.wpi.first.util.WPIUtilJNI;
import java.util.EnumSet;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

import java.util.EnumSet;

import static org.junit.jupiter.api.Assertions.*;

class TopicListenerTest {
private NetworkTableInstance m_serverInst;
private NetworkTableInstance m_clientInst;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import edu.wpi.first.hal.SimDouble;
import edu.wpi.first.util.sendable.Sendable;
import edu.wpi.first.util.sendable.SendableBuilder;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import edu.wpi.first.networktables.NTSendable;
import edu.wpi.first.networktables.NTSendableBuilder;
import edu.wpi.first.util.sendable.SendableRegistry;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import edu.wpi.first.networktables.NTSendable;
import edu.wpi.first.networktables.NTSendableBuilder;
import edu.wpi.first.util.sendable.SendableRegistry;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

Expand Down
1 change: 0 additions & 1 deletion wpilibj/src/main/java/edu/wpi/first/wpilibj/ADXL362.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import edu.wpi.first.networktables.NTSendable;
import edu.wpi.first.networktables.NTSendableBuilder;
import edu.wpi.first.util.sendable.SendableRegistry;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import edu.wpi.first.util.sendable.Sendable;
import edu.wpi.first.util.sendable.SendableBuilder;
import edu.wpi.first.util.sendable.SendableRegistry;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

package edu.wpi.first.wpilibj;

import static edu.wpi.first.util.ErrorMessages.requireNonNullParam;

import edu.wpi.first.hal.FRCNetComm.tResourceType;
import edu.wpi.first.hal.HAL;
import edu.wpi.first.util.sendable.Sendable;
import edu.wpi.first.util.sendable.SendableBuilder;
import edu.wpi.first.util.sendable.SendableRegistry;

import static edu.wpi.first.util.ErrorMessages.requireNonNullParam;

/**
* Handle operation of an analog accelerometer. The accelerometer reads acceleration directly
* through the sensor. Many sensors have multiple axis and can be treated as multiple devices. Each
Expand Down
4 changes: 2 additions & 2 deletions wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogGyro.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

package edu.wpi.first.wpilibj;

import static edu.wpi.first.util.ErrorMessages.requireNonNullParam;

import edu.wpi.first.hal.AnalogGyroJNI;
import edu.wpi.first.hal.FRCNetComm.tResourceType;
import edu.wpi.first.hal.HAL;
Expand All @@ -12,8 +14,6 @@
import edu.wpi.first.util.sendable.SendableBuilder;
import edu.wpi.first.util.sendable.SendableRegistry;

import static edu.wpi.first.util.ErrorMessages.requireNonNullParam;

/**
* Use a rate gyro to return the robots heading relative to a starting position. The Gyro class
* tracks the robots heading based on the starting position. As the robot rotates the new heading is
Expand Down
Loading

0 comments on commit c3559ad

Please sign in to comment.