All Downloads are FREE. Search and download functionalities are using the official Maven repository.

generator.server.javatool.base.test.error.TooManyElementsExceptionTest.mustache Maven / Gradle / Ivy

There is a newer version: 1.22.0
Show newest version
package {{packageName}}.shared.error.domain;

import static org.assertj.core.api.Assertions.*;

import org.junit.jupiter.api.Test;
import {{packageName}}.UnitTest;

@UnitTest
class TooManyElementsExceptionTest {

  @Test
  void shouldGetExceptionInformation() {
    TooManyElementsException exception = TooManyElementsException.builder().field("myField").maxSize(1).size(10).build();

    assertThat(exception.type()).isEqualTo(AssertionErrorType.TOO_MANY_ELEMENTS);
    assertThat(exception.field()).isEqualTo("myField");
    assertThat(exception.parameters()).containsOnly(entry("maxSize", "1"), entry("currentSize", "10"));
    assertThat(exception.getMessage()).isEqualTo("Size of collection \"myField\" must be at most 1 but was 10");
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy