Move tests to JUnit 5 wherever possible

This commit is contained in:
Andy Wilkinson
2019-05-24 11:24:29 +01:00
parent 36f56d034a
commit b18fffaf14
1320 changed files with 13424 additions and 14185 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
package org.springframework.boot.testsupport.assertj;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
@@ -27,27 +27,27 @@ import static org.hamcrest.Matchers.startsWith;
*
* @author Phillip Webb
*/
public class MatchedTests {
class MatchedTests {
@Test
public void byMatcherMatches() {
void byMatcherMatches() {
assertThat("1234").is(Matched.by(startsWith("12")));
}
@Test
public void byMatcherDoesNotMatch() {
void byMatcherDoesNotMatch() {
assertThatExceptionOfType(AssertionError.class)
.isThrownBy(() -> assertThat("1234").is(Matched.by(startsWith("23"))))
.withMessageContaining("a string starting with \"23\"");
}
@Test
public void whenMatcherMatches() {
void whenMatcherMatches() {
assertThat("1234").is(Matched.when(startsWith("12")));
}
@Test
public void whenMatcherDoesNotMatch() {
void whenMatcherDoesNotMatch() {
assertThatExceptionOfType(AssertionError.class)
.isThrownBy(() -> assertThat("1234").is(Matched.when(startsWith("23"))))
.withMessageContaining("a string starting with \"23\"");