Search in sources :

Example 1 with CodedRuntimeException

use of org.molgenis.util.exception.CodedRuntimeException in project molgenis by molgenis.

the class UnknownPermissionQueryParamExceptionTest method testGetMessage.

@Test
void testGetMessage() {
    CodedRuntimeException ex = new UnknownPermissionQueryParamException("type");
    assertEquals("key:type", ex.getMessage());
}
Also used : CodedRuntimeException(org.molgenis.util.exception.CodedRuntimeException) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) ExceptionMessageTest(org.molgenis.util.exception.ExceptionMessageTest)

Example 2 with CodedRuntimeException

use of org.molgenis.util.exception.CodedRuntimeException in project molgenis by molgenis.

the class CouldNotUploadAppExceptionTest method testGetMessage.

@Test
void testGetMessage() {
    CodedRuntimeException ex = new CouldNotUploadAppException("app.zip");
    assertEquals("app.zip", ex.getMessage());
}
Also used : CodedRuntimeException(org.molgenis.util.exception.CodedRuntimeException) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) ExceptionMessageTest(org.molgenis.util.exception.ExceptionMessageTest)

Example 3 with CodedRuntimeException

use of org.molgenis.util.exception.CodedRuntimeException in project molgenis by molgenis.

the class AggregationExceptionTest method testGetMessageNoDetails.

@Test
void testGetMessageNoDetails() {
    CodedRuntimeException ex = new AggregationException(List.of("index1", "index2"), new IOException("IO"));
    assertEquals("indices:index1, index2, detailMessage:null", ex.getMessage());
    assertEquals("IX01", ex.getErrorCode());
}
Also used : IOException(java.io.IOException) CodedRuntimeException(org.molgenis.util.exception.CodedRuntimeException) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) ExceptionMessageTest(org.molgenis.util.exception.ExceptionMessageTest)

Example 4 with CodedRuntimeException

use of org.molgenis.util.exception.CodedRuntimeException in project molgenis by molgenis.

the class DocumentDeleteExceptionTest method testGetMessage.

@Test
void testGetMessage() {
    CodedRuntimeException ex = new DocumentDeleteException("index", "id", new IOException("error"));
    assertEquals("indices:index, id:id", ex.getMessage());
}
Also used : IOException(java.io.IOException) CodedRuntimeException(org.molgenis.util.exception.CodedRuntimeException) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) ExceptionMessageTest(org.molgenis.util.exception.ExceptionMessageTest)

Example 5 with CodedRuntimeException

use of org.molgenis.util.exception.CodedRuntimeException in project molgenis by molgenis.

the class AggregationTimeoutExceptionTest method testGetMessage.

@Test
void testGetMessage() {
    CodedRuntimeException ex = new AggregationTimeoutException(List.of("index1", "index2"), 20000L);
    assertEquals("indices:index1, index2, millis:20000", ex.getMessage());
}
Also used : CodedRuntimeException(org.molgenis.util.exception.CodedRuntimeException) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) ExceptionMessageTest(org.molgenis.util.exception.ExceptionMessageTest)

Aggregations

Test (org.junit.jupiter.api.Test)33 CodedRuntimeException (org.molgenis.util.exception.CodedRuntimeException)33 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)28 ExceptionMessageTest (org.molgenis.util.exception.ExceptionMessageTest)28 IOException (java.io.IOException)5 AbstractMockitoTest (org.molgenis.test.AbstractMockitoTest)4 HttpStatus (org.springframework.http.HttpStatus)3 BindException (org.springframework.validation.BindException)2 BindingResult (org.springframework.validation.BindingResult)2 MapBindingResult (org.springframework.validation.MapBindingResult)2 HttpHeaders (org.springframework.http.HttpHeaders)1 ResponseEntity (org.springframework.http.ResponseEntity)1 FieldError (org.springframework.validation.FieldError)1 ObjectError (org.springframework.validation.ObjectError)1