Java Code Examples for org.junit.jupiter.api.Assertions#assertAll()
The following examples show how to use
org.junit.jupiter.api.Assertions#assertAll() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OperationPatternTest.java From panda with Apache License 2.0 | 6 votes |
@Test public void testVagueExtractor() { Snippet snippet = PandaLexer.of(new PandaSyntax()) .build() .convert(SOURCE); OperationPatternResult result = EXTRACTOR.extract(snippet); Assertions.assertNotNull(result); Assertions.assertTrue(result.isMatched()); Assertions.assertEquals(3, result.size()); Assertions.assertAll( () -> Assertions.assertEquals("( new Integer ( 5 ) . intValue ( ) + 3 )", result.get(0)), () -> Assertions.assertEquals("+", result.get(1)), () -> Assertions.assertEquals("2", result.get(2)) ); }
Example 2
Source File: ApplitoolsVisualCheckFactoryTests.java From vividus with Apache License 2.0 | 6 votes |
@Test void shouldCreateApplitoolsVisualCheckAndSetDefaultProperties() { ApplitoolsVisualCheck expected = new ApplitoolsVisualCheck(BATCH_NAME, BASELINE, ACTION); when(visualCheckFactory.create(eq(BASELINE), eq(ACTION), factoryMatcher())) .thenReturn(expected); ApplitoolsVisualCheck applitoolsVisualCheck = factory.create(BATCH_NAME, BASELINE, ACTION); assertSame(expected, applitoolsVisualCheck); Assertions.assertAll( () -> assertEquals(BASELINE, applitoolsVisualCheck.getBaselineName()), () -> assertEquals(ACTION, applitoolsVisualCheck.getAction()), () -> assertEquals(BATCH_NAME, applitoolsVisualCheck.getBatchName()), () -> assertEquals(EXECUTE_API_KEY, applitoolsVisualCheck.getExecuteApiKey()), () -> assertEquals(HOST_APP, applitoolsVisualCheck.getHostApp()), () -> assertEquals(HOST_OS, applitoolsVisualCheck.getHostOS()), () -> assertEquals(MATCH_LEVEL, applitoolsVisualCheck.getMatchLevel()), () -> assertEquals(READ_API_KEY, applitoolsVisualCheck.getReadApiKey()), () -> assertEquals(SERVER_URI, applitoolsVisualCheck.getServerUri()), () -> assertEquals(VIEWPORT_SIZE, applitoolsVisualCheck.getViewportSize()), () -> assertEquals(BASELINE_ENV_NAME, applitoolsVisualCheck.getBaselineEnvName()), () -> assertEquals("Application", applitoolsVisualCheck.getAppName())); }
Example 3
Source File: TestGeciReflectionTools.java From javageci with Apache License 2.0 | 6 votes |
@Test void normalizesGenericNames() { Assertions.assertAll( () -> assertEquals("String", GeciReflectionTools.normalizeTypeName("java.lang.String")), () -> assertEquals("java.util.Map", GeciReflectionTools.normalizeTypeName("java.util.Map")), () -> assertEquals("java.util.Map<Integer,String>", GeciReflectionTools.normalizeTypeName("java.util.Map<java.lang.Integer,java.lang.String>")), () -> assertEquals("java.util.Map<java.util.Set<Integer>,String>", GeciReflectionTools.normalizeTypeName("java.util.Map<java.util.Set<java.lang.Integer>,java.lang.String>")), () -> assertEquals("java.util.Map<java.util.Set<Integer>,String>", GeciReflectionTools.normalizeTypeName("java.util.Map<java.util.Set< java.lang.Integer>,java.lang.String>")), () -> assertEquals("java.util.Map<java.util.Set<com.java.lang.Integer>,String>", GeciReflectionTools.normalizeTypeName("java.util.Map<java.util.Set< com. java.lang.Integer>,java.lang.String>")), () -> assertEquals("java.util.Map<java.util.Set<? extends com.java.lang.Integer>,String>", GeciReflectionTools.normalizeTypeName("java.util.Map<java.util.Set<? extends com. java.lang.Integer> , java.lang.String>")) ); }
Example 4
Source File: KafkaJunitExtensionTest.java From kafka-junit with Apache License 2.0 | 6 votes |
@Test void testKafkaServerIsUp(KafkaHelper kafkaHelper) { try (KafkaProducer<String, String> producer = kafkaHelper.createStringProducer()) { producer.send(new ProducerRecord<>(TOPIC, "keyA", "valueA")); } try (KafkaConsumer<String, String> consumer = kafkaHelper.createStringConsumer()) { consumer.subscribe(Lists.newArrayList(TOPIC)); ConsumerRecords<String, String> records = consumer.poll(TEN_SECONDS); Assertions.assertAll(() -> assertThat(records).isNotNull(), () -> assertThat(records.isEmpty()).isFalse()); ConsumerRecord<String, String> msg = records.iterator().next(); Assertions.assertAll(() -> assertThat(msg).isNotNull(), () -> assertThat(msg.key()).isEqualTo("keyA"), () -> assertThat(msg.value()).isEqualTo("valueA")); } }
Example 5
Source File: NamingValidatorTest.java From openapi-style-validator with Apache License 2.0 | 6 votes |
@Test void goodUnderscoreCaseShouldReturnTrue() { //Arrange String goodUnderscoreCase1 = "my_variable"; String goodUnderscoreCase2 = "variable"; String goodUnderscoreCase3 = "my_super_variable"; //Act boolean actual1 = validator.isNamingValid(goodUnderscoreCase1, ValidatorParameters.NamingConvention.UnderscoreCase); boolean actual2 = validator.isNamingValid(goodUnderscoreCase2, ValidatorParameters.NamingConvention.UnderscoreCase); boolean actual3 = validator.isNamingValid(goodUnderscoreCase3, ValidatorParameters.NamingConvention.UnderscoreCase); //Assert Assertions.assertAll( () -> assertTrue(actual1), () -> assertTrue(actual2), () -> assertTrue(actual3) ); }
Example 6
Source File: StringUtilsTest.java From panda with Apache License 2.0 | 5 votes |
@Test void lastIndexOf() { Assertions.assertAll( () -> Assertions.assertEquals(2, StringUtils.lastIndexOf("abc", "c", 3)), () -> Assertions.assertEquals(-1, StringUtils.lastIndexOf("abc", "c", 1)), () -> Assertions.assertEquals(-1, StringUtils.lastIndexOf("abc", "d", 3)) ); }
Example 7
Source File: ListsTest.java From panda with Apache License 2.0 | 5 votes |
@Test void get() { Assertions.assertEquals(3, LIST.size()); Assertions.assertAll( () -> Assertions.assertNotNull(Lists.get(LIST, 0)), () -> Assertions.assertNotNull(Lists.get(LIST, 2)), () -> Assertions.assertNull(Lists.get(LIST, -1)), () -> Assertions.assertNull(Lists.get(LIST, 3)) ); }
Example 8
Source File: StringUtilsTest.java From panda with Apache License 2.0 | 5 votes |
@Test void isNumber() { Assertions.assertAll( () -> Assertions.assertFalse(StringUtils.isNumber("test")), () -> Assertions.assertTrue(StringUtils.isNumber("777")), () -> Assertions.assertTrue(StringUtils.isNumber("011")), () -> Assertions.assertTrue(StringUtils.isNumber("0.001")), () -> Assertions.assertTrue(StringUtils.isNumber("0x001")) ); }
Example 9
Source File: ArrayUtilsTest.java From panda with Apache License 2.0 | 5 votes |
@Test void contains() { Assertions.assertAll( () -> Assertions.assertTrue(ArrayUtils.contains(ARRAY, "b")), () -> Assertions.assertFalse(ArrayUtils.contains(EMPTY_ARRAY, "d")), () -> Assertions.assertFalse(ArrayUtils.contains(ARRAY_WITH_NULL, "d")) ); }
Example 10
Source File: ListsTest.java From panda with Apache License 2.0 | 5 votes |
@Test void split() { List<String>[] lists = Lists.split(LIST, "b"); Assertions.assertEquals(2, lists.length); Assertions.assertAll( () -> Assertions.assertEquals(Collections.singletonList("a"), lists[0]), () -> Assertions.assertEquals(Collections.singletonList("c"), lists[1]) ); }
Example 11
Source File: ResourceCheckStepsTests.java From vividus with Apache License 2.0 | 5 votes |
private void validate(ResourceValidation actual, URI uri, String selector, CheckStatus checkStatus) { Assertions.assertAll( () -> assertEquals(uri, actual.getUri()), () -> assertEquals(selector, actual.getCssSelector()), () -> assertSame(checkStatus, actual.getCheckStatus())); }
Example 12
Source File: StringUtilsTest.java From panda with Apache License 2.0 | 5 votes |
@Test void trimEnd() { Assertions.assertAll( // Without changes () -> Assertions.assertEquals("test", StringUtils.trimEnd("test")), () -> Assertions.assertEquals(" test", StringUtils.trimEnd(" test")), () -> Assertions.assertEquals("", StringUtils.trimEnd("")), // With changes () -> Assertions.assertEquals("", StringUtils.trimEnd(" ")), () -> Assertions.assertEquals("test", StringUtils.trimEnd("test ")) ); }
Example 13
Source File: PackageUtilsTest.java From panda with Apache License 2.0 | 5 votes |
@Test void getPackageName() { Assertions.assertAll( () -> Assertions.assertEquals("java.lang", PackageUtils.getPackageName(String.class)), () -> Assertions.assertNull(PackageUtils.getPackageName(void.class)) ); }
Example 14
Source File: ArrayUtilsTest.java From panda with Apache License 2.0 | 5 votes |
@Test void dimensionalArrayClass() { Assertions.assertAll( () -> Assertions.assertEquals(Object[][].class, ArrayUtils.getDimensionalArrayType(Object.class, 3)), () -> Assertions.assertThrows(IllegalArgumentException.class, () -> ArrayUtils.getDimensionalArrayType(Object.class, 0)) ); }
Example 15
Source File: StringUtilsTest.java From panda with Apache License 2.0 | 5 votes |
@Test void containsOtherCharacters() { Assertions.assertAll( () -> Assertions.assertTrue(StringUtils.containsOtherCharacters("abc", new char[] { 'a', 'b' })), () -> Assertions.assertFalse(StringUtils.containsOtherCharacters("abc", new char[] { 'a', 'b', 'c' })) ); }
Example 16
Source File: NamingValidatorTest.java From openapi-style-validator with Apache License 2.0 | 5 votes |
@Test void badUnderscoreCaseShouldReturnFalse() { //Arrange String badUnderscoreCase1 = "myVariable"; String badUnderscoreCase2 = "my-variable"; String badUnderscoreCase3 = "my-Variable"; String badUnderscoreCase4 = "my__variable_lol"; String badUnderscoreCase5 = "_my_variable"; String badUnderscoreCase6 = "my_variable_"; //Act boolean actual1 = validator.isNamingValid(badUnderscoreCase1, ValidatorParameters.NamingConvention.UnderscoreCase); boolean actual2 = validator.isNamingValid(badUnderscoreCase2, ValidatorParameters.NamingConvention.UnderscoreCase); boolean actual3 = validator.isNamingValid(badUnderscoreCase3, ValidatorParameters.NamingConvention.UnderscoreCase); boolean actual4 = validator.isNamingValid(badUnderscoreCase4, ValidatorParameters.NamingConvention.UnderscoreCase); boolean actual5 = validator.isNamingValid(badUnderscoreCase5, ValidatorParameters.NamingConvention.UnderscoreCase); boolean actual6 = validator.isNamingValid(badUnderscoreCase6, ValidatorParameters.NamingConvention.UnderscoreCase); //Assert Assertions.assertAll( () -> assertFalse(actual1), () -> assertFalse(actual2), () -> assertFalse(actual3), () -> assertFalse(actual4), () -> assertFalse(actual5), () -> assertFalse(actual6) ); }
Example 17
Source File: ImageVisualTestingServiceTests.java From vividus with Apache License 2.0 | 5 votes |
@Test void shouldRunVisualTestAndPublishResultsAvoidMissingImagesIssues() throws IOException { ApplitoolsVisualCheck applitoolsVisualCheck = createCheck(); Eyes eyes = mockEyes(applitoolsVisualCheck); mockTestResult(eyes); HttpResponse response = mock(HttpResponse.class); when(response.getStatusCode()).thenReturn(HttpStatus.SC_NOT_FOUND); when(httpClient.doHttpGet(BASELINE_IMAGE_URI)).thenReturn(response); when(httpClient.doHttpGet(CHECKPOINT_IMAGE_URI)).thenThrow(new IOException("API is broken")); HttpResponse emptyResponse = mock(HttpResponse.class); when(emptyResponse.getStatusCode()).thenReturn(HttpStatus.SC_OK); when(httpClient.doHttpGet(DIFF_IMAGE_URI)).thenReturn(emptyResponse); when(emptyResponse.getResponseBody()).thenReturn(null); BufferedImage image = mockScreenshot(applitoolsVisualCheck); InOrder ordered = inOrder(eyes); ApplitoolsVisualCheckResult result = imageVisualTestingService.run(applitoolsVisualCheck); ordered.verify(eyes).open(APP_NAME, BASELINE_NAME); ordered.verify(eyes).checkImage(image); ordered.verify(eyes).close(false); Assertions.assertAll( () -> assertEquals(ACTION, result.getActionType()), () -> assertNull(result.getBaseline()), () -> assertNull(result.getCheckpoint()), () -> assertNull(result.getDiff()), () -> assertEquals(BATCH_URL, result.getBatchUrl()), () -> assertEquals(STEP_EDITOR_URL, result.getStepUrl()), () -> assertTrue(result.isPassed()) ); assertThat(LOGGER.getLoggingEvents(), is(List.of(LoggingEvent.warn("Unable to get image from {}", CHECKPOINT_IMAGE_URI)))); }
Example 18
Source File: ArrayUtilsTest.java From panda with Apache License 2.0 | 5 votes |
@Test void containsNull() { Assertions.assertAll( () -> Assertions.assertTrue(ArrayUtils.containsNull(ARRAY_WITH_NULL)), () -> Assertions.assertFalse(ArrayUtils.containsNull(ARRAY)), () -> Assertions.assertFalse(ArrayUtils.containsNull(EMPTY_ARRAY)) ); }
Example 19
Source File: StringUtilsTest.java From panda with Apache License 2.0 | 5 votes |
@Test void splitFirst() { String[] split = StringUtils.splitFirst("aa,bb,cc", ","); String[] splitEmpty = StringUtils.splitFirst("aaa", ","); Assertions.assertEquals(2, split.length); Assertions.assertEquals(0, splitEmpty.length); Assertions.assertAll( () -> Assertions.assertEquals("aa", split[0]), () -> Assertions.assertEquals("bb,cc", split[1]) ); }
Example 20
Source File: KafkaJunitExtensionConfigTest.java From kafka-junit with Apache License 2.0 | 5 votes |
@Test void unset_values_are_set_to_default() { KafkaJunitExtensionConfig defaultConfig = PartialConfigTest.class.getAnnotation(KafkaJunitExtensionConfig.class); Assertions.assertAll(() -> Assertions.assertEquals(KafkaJunitExtensionConfig.ALLOCATE_RANDOM_PORT, defaultConfig.kafkaPort()), () -> Assertions.assertEquals(KafkaJunitExtensionConfig.ALLOCATE_RANDOM_PORT, defaultConfig.zooKeeperPort()), () -> Assertions.assertEquals(StartupMode.WAIT_FOR_STARTUP, defaultConfig.startupMode())); }