mirror of
https://github.com/jlengrand/error-prone-support.git
synced 2026-03-10 08:11:25 +00:00
Compare commits
2 Commits
junie-init
...
gdejong/ju
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2a9ce49075 | ||
|
|
80a312a829 |
@@ -6,6 +6,7 @@ import static org.assertj.core.api.Assertions.assertThatCode;
|
||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
import static org.assertj.core.api.Assertions.fail;
|
||||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
@@ -517,4 +518,82 @@ final class JUnitToAssertJRules {
|
||||
assertThat(actual).withFailMessage(supplier).isInstanceOf(clazz);
|
||||
}
|
||||
}
|
||||
|
||||
static final class AssertThatByteIsEqualTo {
|
||||
@BeforeTemplate
|
||||
void before(byte actual, byte expected) {
|
||||
assertEquals(actual, expected);
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@UseImportPolicy(STATIC_IMPORT_ALWAYS)
|
||||
void after(byte actual, byte expected) {
|
||||
assertThat(actual).isEqualTo(expected);
|
||||
}
|
||||
}
|
||||
|
||||
static final class AssertThatByteWithFailMessageStringIsEqualTo {
|
||||
@BeforeTemplate
|
||||
void before(byte actual, byte expected, String message) {
|
||||
assertEquals(actual, expected, message);
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@UseImportPolicy(STATIC_IMPORT_ALWAYS)
|
||||
void after(byte actual, byte expected, String message) {
|
||||
assertThat(actual).withFailMessage(message).isEqualTo(expected);
|
||||
}
|
||||
}
|
||||
|
||||
static final class AssertThatByteWithFailMessageSupplierIsEqualTo {
|
||||
@BeforeTemplate
|
||||
void before(byte actual, byte expected, Supplier<String> message) {
|
||||
assertEquals(actual, expected, message);
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@UseImportPolicy(STATIC_IMPORT_ALWAYS)
|
||||
void after(byte actual, byte expected, Supplier<String> message) {
|
||||
assertThat(actual).withFailMessage(message).isEqualTo(expected);
|
||||
}
|
||||
}
|
||||
|
||||
static final class AssertThatCharIsEqualTo {
|
||||
@BeforeTemplate
|
||||
void before(char actual, char expected) {
|
||||
assertEquals(actual, expected);
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@UseImportPolicy(STATIC_IMPORT_ALWAYS)
|
||||
void after(char actual, char expected) {
|
||||
assertThat(actual).isEqualTo(expected);
|
||||
}
|
||||
}
|
||||
|
||||
static final class AssertThatCharWithFailMessageStringIsEqualTo {
|
||||
@BeforeTemplate
|
||||
void before(char actual, char expected, String message) {
|
||||
assertEquals(actual, expected, message);
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@UseImportPolicy(STATIC_IMPORT_ALWAYS)
|
||||
void after(char actual, char expected, String message) {
|
||||
assertThat(actual).withFailMessage(message).isEqualTo(expected);
|
||||
}
|
||||
}
|
||||
|
||||
static final class AssertThatCharWithFailMessageSupplierIsEqualTo {
|
||||
@BeforeTemplate
|
||||
void before(char actual, char expected, Supplier<String> message) {
|
||||
assertEquals(actual, expected, message);
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@UseImportPolicy(STATIC_IMPORT_ALWAYS)
|
||||
void after(char actual, char expected, Supplier<String> message) {
|
||||
assertThat(actual).withFailMessage(message).isEqualTo(expected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package tech.picnic.errorprone.refasterrules;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
@@ -29,7 +30,10 @@ final class JUnitToAssertJRulesTest implements RefasterRuleCollectionTestCase {
|
||||
(Runnable) () -> assertNotSame(null, null),
|
||||
(Runnable) () -> assertNull(null),
|
||||
(Runnable) () -> assertSame(null, null),
|
||||
(Runnable) () -> assertTrue(true));
|
||||
(Runnable) () -> assertTrue(true),
|
||||
(Runnable) () -> assertEquals(0, 0),
|
||||
(Runnable) () -> assertEquals(0, 0, "foo"),
|
||||
(Runnable) () -> assertEquals(0, 0, () -> "foo"));
|
||||
}
|
||||
|
||||
void testThrowNewAssertionError() {
|
||||
@@ -170,4 +174,28 @@ final class JUnitToAssertJRulesTest implements RefasterRuleCollectionTestCase {
|
||||
void testAssertThatWithFailMessageSupplierIsInstanceOf() {
|
||||
assertInstanceOf(Object.class, new Object(), () -> "foo");
|
||||
}
|
||||
|
||||
void testAssertThatByteIsEqualTo() {
|
||||
assertEquals((byte) 0, (byte) 0);
|
||||
}
|
||||
|
||||
void testAssertThatByteWithFailMessageStringIsEqualTo() {
|
||||
assertEquals((byte) 0, (byte) 0, "foo");
|
||||
}
|
||||
|
||||
void testAssertThatByteWithFailMessageSupplierIsEqualTo() {
|
||||
assertEquals((byte) 0, (byte) 0, () -> "foo");
|
||||
}
|
||||
|
||||
void testAssertThatCharIsEqualTo() {
|
||||
assertEquals('a', 'a');
|
||||
}
|
||||
|
||||
void testAssertThatCharWithFailMessageStringIsEqualTo() {
|
||||
assertEquals('a', 'a', "foo");
|
||||
}
|
||||
|
||||
void testAssertThatCharWithFailMessageSupplierIsEqualTo() {
|
||||
assertEquals('a', 'a', () -> "foo");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import static org.assertj.core.api.Assertions.assertThatCode;
|
||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
import static org.assertj.core.api.Assertions.fail;
|
||||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
@@ -33,7 +34,10 @@ final class JUnitToAssertJRulesTest implements RefasterRuleCollectionTestCase {
|
||||
(Runnable) () -> assertNotSame(null, null),
|
||||
(Runnable) () -> assertNull(null),
|
||||
(Runnable) () -> assertSame(null, null),
|
||||
(Runnable) () -> assertTrue(true));
|
||||
(Runnable) () -> assertTrue(true),
|
||||
(Runnable) () -> assertEquals(0, 0),
|
||||
(Runnable) () -> assertEquals(0, 0, "foo"),
|
||||
(Runnable) () -> assertEquals(0, 0, () -> "foo"));
|
||||
}
|
||||
|
||||
void testThrowNewAssertionError() {
|
||||
@@ -180,4 +184,28 @@ final class JUnitToAssertJRulesTest implements RefasterRuleCollectionTestCase {
|
||||
void testAssertThatWithFailMessageSupplierIsInstanceOf() {
|
||||
assertThat(new Object()).withFailMessage(() -> "foo").isInstanceOf(Object.class);
|
||||
}
|
||||
|
||||
void testAssertThatByteIsEqualTo() {
|
||||
assertThat((byte) 0).isEqualTo((byte) 0);
|
||||
}
|
||||
|
||||
void testAssertThatByteWithFailMessageStringIsEqualTo() {
|
||||
assertThat((byte) 0).withFailMessage("foo").isEqualTo((byte) 0);
|
||||
}
|
||||
|
||||
void testAssertThatByteWithFailMessageSupplierIsEqualTo() {
|
||||
assertThat((byte) 0).withFailMessage(() -> "foo").isEqualTo((byte) 0);
|
||||
}
|
||||
|
||||
void testAssertThatCharIsEqualTo() {
|
||||
assertThat('a').isEqualTo('a');
|
||||
}
|
||||
|
||||
void testAssertThatCharWithFailMessageStringIsEqualTo() {
|
||||
assertThat('a').withFailMessage("foo").isEqualTo('a');
|
||||
}
|
||||
|
||||
void testAssertThatCharWithFailMessageSupplierIsEqualTo() {
|
||||
assertThat('a').withFailMessage(() -> "foo").isEqualTo('a');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user