Search in sources :

Example 21 with Configuration

use of org.jooq.Configuration in project spring-boot by spring-projects.

the class JooqExceptionTranslatorTests method exceptionTranslation.

@Test
public void exceptionTranslation() {
    ExecuteContext context = mock(ExecuteContext.class);
    Configuration configuration = mock(Configuration.class);
    given(context.configuration()).willReturn(configuration);
    given(configuration.dialect()).willReturn(this.dialect);
    given(context.sqlException()).willReturn(this.sqlException);
    this.exceptionTranslator.exception(context);
    ArgumentCaptor<RuntimeException> captor = ArgumentCaptor.forClass(RuntimeException.class);
    verify(context).exception(captor.capture());
    assertThat(captor.getValue()).isInstanceOf(BadSqlGrammarException.class);
}
Also used : Configuration(org.jooq.Configuration) ExecuteContext(org.jooq.ExecuteContext) Test(org.junit.Test)

Aggregations

Configuration (org.jooq.Configuration)21 AttachableInternal (org.jooq.AttachableInternal)4 StringUtils.defaultString (org.jooq.tools.StringUtils.defaultString)4 OffsetDateTime (java.time.OffsetDateTime)3 ArrayList (java.util.ArrayList)3 List (java.util.List)3 ExecuteContext (org.jooq.ExecuteContext)3 Query (org.jooq.Query)3 BigDecimal (java.math.BigDecimal)2 BigInteger (java.math.BigInteger)2 Date (java.sql.Date)2 Time (java.sql.Time)2 LocalDate (java.time.LocalDate)2 LocalDateTime (java.time.LocalDateTime)2 LocalTime (java.time.LocalTime)2 OffsetTime (java.time.OffsetTime)2 SQLDialect (org.jooq.SQLDialect)2 DefaultExecuteContext.localConfiguration (org.jooq.impl.DefaultExecuteContext.localConfiguration)2 Preconditions.checkNotNull (com.google.common.base.Preconditions.checkNotNull)1 ImmutableSet (com.google.common.collect.ImmutableSet)1