use of org.assertj.core.internal.TestDescription in project assertj-core by joel-costigliola.
the class ShouldHavePort_create_Test method should_create_error_message_for_url.
@Test
public void should_create_error_message_for_url() throws Exception {
String error = shouldHavePort(new URL("http://assertj.org:8080/news"), 8888).create(new TestDescription("TEST"));
assertThat(error).isEqualTo(format("[TEST] %n" + "Expecting port of%n" + " <http://assertj.org:8080/news>%n" + "to be:%n" + " <8888>%n" + "but was:%n" + " <8080>"));
}
use of org.assertj.core.internal.TestDescription in project assertj-core by joel-costigliola.
the class ShouldHaveQuery_create_Test method should_create_error_message_for_uri_has_no_query.
@Test
public void should_create_error_message_for_uri_has_no_query() throws Exception {
URI uri = new URI("http://assertj.org/news?type=beta");
String error = shouldHaveQuery(uri, null).create(new TestDescription("TEST"));
assertThat(error).isEqualTo(format("[TEST] %n" + "Expecting:%n" + " <http://assertj.org/news?type=beta>%n" + "not to have a query but had:%n" + " <\"type=beta\">"));
}
use of org.assertj.core.internal.TestDescription in project assertj-core by joel-costigliola.
the class ShouldNotExist_create_Test method setUp.
@Before
public void setUp() {
description = new TestDescription("Test");
representation = new StandardRepresentation();
}
use of org.assertj.core.internal.TestDescription in project assertj-core by joel-costigliola.
the class ShouldNotHaveAnyElementsOfTypes_create_Test method should_create_error_message.
@Test
public void should_create_error_message() {
// GIVEN
List<Number> actual = new ArrayList<>();
actual.add(1);
actual.add(2);
actual.add(3.0);
actual.add(4.1);
actual.add(BigDecimal.ONE);
Class<?>[] unexpectedTypes = { Long.class, Double.class, BigDecimal.class };
Map<Class<?>, List<Object>> nonMatchingElementsByType = new LinkedHashMap<>();
nonMatchingElementsByType.put(BigDecimal.class, asObjectList(BigDecimal.ONE));
nonMatchingElementsByType.put(Double.class, asObjectList(3.0, 4.1));
ShouldNotHaveAnyElementsOfTypes shouldNotHaveAnyElementsOfTypes = shouldNotHaveAnyElementsOfTypes(actual, unexpectedTypes, nonMatchingElementsByType);
// WHEN
String message = shouldNotHaveAnyElementsOfTypes.create(new TestDescription("Test"), CONFIGURATION_PROVIDER.representation());
// THEN
assertThat(message).isEqualTo(format("[Test] %n" + "Expecting:%n" + " <[1, 2, 3.0, 4.1, 1]>%n" + "to not have any elements of the following types:%n" + " <[java.lang.Long, java.lang.Double, java.math.BigDecimal]>%n" + "but found:%n" + " <{java.math.BigDecimal=[1], java.lang.Double=[3.0, 4.1]}>"));
}
use of org.assertj.core.internal.TestDescription in project assertj-core by joel-costigliola.
the class ShouldHaveScheme_create_Test method should_create_error_message.
@Test
public void should_create_error_message() throws Exception {
String error = shouldHaveScheme(new URI("http://assertj.org/"), "ftp").create(new TestDescription("TEST"));
assertThat(error).isEqualTo(format("[TEST] %n" + "Expecting scheme of%n" + " <http://assertj.org/>%n" + "to be:%n" + " <\"ftp\">%n" + "but was:%n" + " <\"http\">"));
}
Aggregations