mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
simplifiable assertions for junit 5: tests
This commit is contained in:
+9
@@ -0,0 +1,9 @@
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
|
||||
class MyTest {
|
||||
{
|
||||
Assertions.assertTrue(foo(), () -> "message");
|
||||
}
|
||||
|
||||
boolean foo() {return false;}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
class MyTest {
|
||||
{
|
||||
org.junit.jupiter.api.Assertions.assert<caret>Equals(true, foo(), () -> "message");
|
||||
}
|
||||
|
||||
boolean foo() {return false;}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
|
||||
class MyTest {
|
||||
{
|
||||
Assertions.assertEquals(foo(), foo(), () -> "message");
|
||||
}
|
||||
|
||||
Object foo() {return null;}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
|
||||
class MyTest {
|
||||
{
|
||||
Assertions.assert<caret>True(foo().equals(foo()), () -> "message");
|
||||
}
|
||||
|
||||
Object foo() {return null;}
|
||||
}
|
||||
+13
@@ -28,6 +28,8 @@ public class SimplifiableJUnitAssertionFixTest extends IGQuickFixesTestCase {
|
||||
public void testJUnit4TestCase() { doTest(); }
|
||||
public void testIntegerPrimitive() { doTest(); }
|
||||
public void testDoublePrimitive() { doTest(); }
|
||||
public void testEqualsToTrueJUnit5() { doTest(); }
|
||||
public void testTrueToEqualsJUnit5() { doTest(); }
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
@@ -67,5 +69,16 @@ public class SimplifiableJUnitAssertionFixTest extends IGQuickFixesTestCase {
|
||||
"@Retention(RetentionPolicy.RUNTIME)" +
|
||||
"@Target({ElementType.METHOD})" +
|
||||
"public @interface Test {}");
|
||||
|
||||
myFixture.addClass("package java.util.function; public interface Supplier<T> { T get();}");
|
||||
|
||||
myFixture.addClass("package org.junit.jupiter.api;\n" +
|
||||
"import java.util.function.Supplier;\n" +
|
||||
"public final class Assertions {\n" +
|
||||
" public static void assertEquals(Object expected, Object actual) {}\n" +
|
||||
" public static void assertTrue(boolean expected) {}\n" +
|
||||
" public static void assertEquals(Object expected, Object actual, Supplier<String> message) {}\n" +
|
||||
" public static void assertTrue(Object expected, Supplier<String> message) {}\n" +
|
||||
"}");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user