I am attempting to test an library I am designing using JUnit5. I have come to the point where I need to assert something is false however Gradle is running into errors whenever I attempt to use assertFalse(...)
.
I am using JUnit 5.2 with Gradle 5.1.1 and have tried the assertFalse() method signatures that fit my needs to no avail. This includes just with a boolean condition, with a condition plus a message, using Assertions.assertFalse(...)
to remove the static import, etc.
I have been able to narrow down the code to just a simple test. The code below fails:
@Test
void test(){
assertFalse(false);
}
My imports are:
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
//plus some others from the library
Gradle gives an error of:
ProjectDir/FTC_Robot_API/TeamCode
/src/test/java/org/firstinspires/ftc/teamcode/FTC_Library/Robot
/RobotBaseTest.java:28: error: cannot access BooleanSupplier
assertFalse(false);
^
class file for java.util.function.BooleanSupplier not found
1 error
It is my hope that what is obviously a boolean (false
) is not a BooleanSupplier so I am stuck with regards to why it is giving me this error. Any help is appreciated
I had the same issue when using IntelliJ. To resolve it
.iml
and .idea
files)