41 lines
954 B
Java
Raw Normal View History

2016-04-15 23:47:32 +03:00
package com.baeldung;
2016-05-02 13:00:21 +03:00
import org.junit.gen5.api.Disabled;
2016-04-15 23:47:32 +03:00
import org.junit.gen5.api.Test;
2016-05-11 00:00:29 +03:00
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
2016-04-15 23:47:32 +03:00
import static org.junit.gen5.api.Assertions.assertAll;
import static org.junit.gen5.api.Assertions.assertEquals;
import static org.junit.gen5.api.Assertions.assertTrue;
class FirstTest {
@Test
void lambdaExpressions() {
2016-05-11 00:00:29 +03:00
List<Integer> numbers = Arrays.asList(1, 2, 3);
assertTrue(numbers
.stream()
.mapToInt(i -> i)
.sum() > 5, "Sum should be greater than 5");
2016-04-15 23:47:32 +03:00
}
@Test
void groupAssertions() {
2016-05-11 00:00:29 +03:00
int[] numbers = {0, 1, 2, 3, 4};
2016-04-15 23:47:32 +03:00
assertAll("numbers", () -> {
assertEquals(numbers[0], 1);
assertEquals(numbers[3], 3);
assertEquals(numbers[4], 1);
});
}
2016-05-02 13:00:21 +03:00
@Test
@Disabled
void disabledTest() {
assertTrue(false);
}
2016-04-15 23:47:32 +03:00
}