Search in sources :

Example 36 with TestDescription

use of org.assertj.core.internal.TestDescription in project assertj-core by joel-costigliola.

the class ShouldHaveParameter_create_Test method should_create_error_message_for_url_no_parameter_value_but_found.

@Test
public void should_create_error_message_for_url_no_parameter_value_but_found() throws Exception {
    URL url = new URL("http://assertj.org/news?article=10");
    String error = shouldHaveNoParameter(url, "article", "10", newArrayList("10")).create(new TestDescription("TEST"));
    assertThat(error).isEqualTo(format("[TEST] %n" + "Expecting:%n" + "  <http://assertj.org/news?article=10>%n" + "not to have parameter:%n" + "  <\"article\">%n" + "with value:%n" + "  <\"10\">%n" + "but did"));
}
Also used : TestDescription(org.assertj.core.internal.TestDescription) URL(java.net.URL) Test(org.junit.Test)

Example 37 with TestDescription

use of org.assertj.core.internal.TestDescription in project assertj-core by joel-costigliola.

the class ShouldHaveParameter_create_Test method should_create_error_message_for_uri_with_no_parameter_that_has_one_with_multiple_values.

@Test
public void should_create_error_message_for_uri_with_no_parameter_that_has_one_with_multiple_values() throws Exception {
    URI uri = new URI("http://assertj.org/news?article=10");
    String error = shouldHaveNoParameter(uri, "article", newArrayList("10", "11")).create(new TestDescription("TEST"));
    assertThat(error).isEqualTo(format("[TEST] %n" + "Expecting:%n" + "  <http://assertj.org/news?article=10>%n" + "not to have parameter:%n" + "  <\"article\">%n" + "but parameter was present with values:%n" + "  <\"[10, 11]\">"));
}
Also used : TestDescription(org.assertj.core.internal.TestDescription) URI(java.net.URI) Test(org.junit.Test)

Example 38 with TestDescription

use of org.assertj.core.internal.TestDescription in project assertj-core by joel-costigliola.

the class ShouldHaveParameter_create_Test method should_create_error_message_for_uri_with_no_parameter_that_has_one_with_value.

@Test
public void should_create_error_message_for_uri_with_no_parameter_that_has_one_with_value() throws Exception {
    URI uri = new URI("http://assertj.org/news?article=10");
    String error = shouldHaveNoParameter(uri, "article", newArrayList("10")).create(new TestDescription("TEST"));
    assertThat(error).isEqualTo(format("[TEST] %n" + "Expecting:%n" + "  <http://assertj.org/news?article=10>%n" + "not to have parameter:%n" + "  <\"article\">%n" + "but parameter was present with value:%n" + "  <\"10\">"));
}
Also used : TestDescription(org.assertj.core.internal.TestDescription) URI(java.net.URI) Test(org.junit.Test)

Example 39 with TestDescription

use of org.assertj.core.internal.TestDescription in project assertj-core by joel-costigliola.

the class ShouldHaveParameter_create_Test method should_create_error_message_for_uri_with_no_parameter_that_has_one_even_without_value.

@Test
public void should_create_error_message_for_uri_with_no_parameter_that_has_one_even_without_value() throws Exception {
    URI uri = new URI("http://assertj.org/news?article");
    String error = shouldHaveNoParameter(uri, "article", null).create(new TestDescription("TEST"));
    assertThat(error).isEqualTo(format("[TEST] %n" + "Expecting:%n" + "  <http://assertj.org/news?article>%n" + "not to have parameter:%n" + "  <\"article\">%n" + "but parameter was present with no value"));
}
Also used : TestDescription(org.assertj.core.internal.TestDescription) URI(java.net.URI) Test(org.junit.Test)

Example 40 with TestDescription

use of org.assertj.core.internal.TestDescription in project assertj-core by joel-costigliola.

the class ShouldHaveParameter_create_Test method should_create_error_message_for_uri_parameter_without_value_that_has_one.

@Test
public void should_create_error_message_for_uri_parameter_without_value_that_has_one() throws Exception {
    URI uri = new URI("http://assertj.org/news?article=10");
    String error = shouldHaveParameter(uri, "article", null, newArrayList("10")).create(new TestDescription("TEST"));
    assertThat(error).isEqualTo(format("[TEST] %n" + "Expecting:%n" + "  <http://assertj.org/news?article=10>%n" + "to have parameter:%n" + "  <\"article\">%n" + "with no value, but parameter had value:%n" + "  <\"10\">"));
}
Also used : TestDescription(org.assertj.core.internal.TestDescription) URI(java.net.URI) Test(org.junit.Test)

Aggregations

TestDescription (org.assertj.core.internal.TestDescription)126 Test (org.junit.Test)112 StandardRepresentation (org.assertj.core.presentation.StandardRepresentation)48 URI (java.net.URI)27 URL (java.net.URL)24 CompletableFuture (java.util.concurrent.CompletableFuture)9 Before (org.junit.Before)9 Description (org.assertj.core.description.Description)4 Path (java.nio.file.Path)2 EmptyTextDescription.emptyDescription (org.assertj.core.description.EmptyTextDescription.emptyDescription)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1 LinkedHashMap (java.util.LinkedHashMap)1 List (java.util.List)1 AtomicStampedReference (java.util.concurrent.atomic.AtomicStampedReference)1 ShouldHaveToString.shouldHaveToString (org.assertj.core.error.ShouldHaveToString.shouldHaveToString)1 Representation (org.assertj.core.presentation.Representation)1 CaseInsensitiveStringComparator (org.assertj.core.util.CaseInsensitiveStringComparator)1