From 73047d8b35a80e89e8717c5129428f091dc10f3e Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 16 Aug 2020 19:40:11 -0700 Subject: [PATCH] [wpiutil] Fix WPIUtilJNI.now() implementation (#2640) --- .../src/main/native/cpp/jni/WPIUtilJNI.cpp | 4 ++-- .../edu/wpi/first/wpiutil/WPIUtilJNITest.java | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 wpiutil/src/test/java/edu/wpi/first/wpiutil/WPIUtilJNITest.java diff --git a/wpiutil/src/main/native/cpp/jni/WPIUtilJNI.cpp b/wpiutil/src/main/native/cpp/jni/WPIUtilJNI.cpp index fcf99e1c37..90a2291469 100644 --- a/wpiutil/src/main/native/cpp/jni/WPIUtilJNI.cpp +++ b/wpiutil/src/main/native/cpp/jni/WPIUtilJNI.cpp @@ -27,12 +27,12 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved) { JNIEXPORT void JNICALL JNI_OnUnload(JavaVM* vm, void* reserved) {} /* - * Class: edu_wpi_first_networktables_NetworkTablesJNI + * Class: edu_wpi_first_wpiutil_WPIUtilJNI * Method: now * Signature: ()J */ JNIEXPORT jlong JNICALL -Java_edu_wpi_first_networktables_NetworkTablesJNI_now +Java_edu_wpi_first_wpiutil_WPIUtilJNI_now (JNIEnv*, jclass) { return wpi::Now(); diff --git a/wpiutil/src/test/java/edu/wpi/first/wpiutil/WPIUtilJNITest.java b/wpiutil/src/test/java/edu/wpi/first/wpiutil/WPIUtilJNITest.java new file mode 100644 index 0000000000..e92efe417a --- /dev/null +++ b/wpiutil/src/test/java/edu/wpi/first/wpiutil/WPIUtilJNITest.java @@ -0,0 +1,19 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) 2020 FIRST. All Rights Reserved. */ +/* Open Source Software - may be modified and shared by FRC teams. The code */ +/* must be accompanied by the FIRST BSD license file in the root directory of */ +/* the project. */ +/*----------------------------------------------------------------------------*/ + +package edu.wpi.first.wpiutil; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; + +public class WPIUtilJNITest { + @Test + public void testNow() { + assertDoesNotThrow(WPIUtilJNI::now); + } +}