com.github.t1:problem-details-test

Problem Detail test suite for JAX-RS

Лицензия

Лицензия

Группа

Группа

com.github.t1
Идентификатор

Идентификатор

problem-details-test
Последняя версия

Последняя версия

1.0.9
Дата

Дата

Тип

Тип

war
Описание

Описание

Problem Detail test suite for JAX-RS

Скачать problem-details-test

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.github.t1/problem-details-test/ -->
<dependency>
    <groupId>com.github.t1</groupId>
    <artifactId>problem-details-test</artifactId>
    <version>1.0.9</version>
    <type>war</type>
</dependency>
// https://jarcasting.com/artifacts/com.github.t1/problem-details-test/
implementation 'com.github.t1:problem-details-test:1.0.9'
// https://jarcasting.com/artifacts/com.github.t1/problem-details-test/
implementation ("com.github.t1:problem-details-test:1.0.9")
'com.github.t1:problem-details-test:war:1.0.9'
<dependency org="com.github.t1" name="problem-details-test" rev="1.0.9">
  <artifact name="problem-details-test" type="war" />
</dependency>
@Grapes(
@Grab(group='com.github.t1', module='problem-details-test', version='1.0.9')
)
libraryDependencies += "com.github.t1" % "problem-details-test" % "1.0.9"
[com.github.t1/problem-details-test "1.0.9"]

Зависимости

compile (2)

Идентификатор библиотеки Тип Версия
com.github.t1 : problem-details-api jar 1.0.9
com.github.t1 : problem-details-ri jar 1.0.9

provided (5)

Идентификатор библиотеки Тип Версия
org.projectlombok : lombok jar 1.18.18
jakarta.platform : jakarta.jakartaee-api jar 8.0.0
org.eclipse.microprofile : microprofile pom 3.3
org.slf4j : slf4j-api jar 1.7.30
javax.xml.bind : jaxb-api jar 2.3.1

test (10)

Идентификатор библиотеки Тип Версия
org.junit.jupiter : junit-jupiter jar 5.7.1
org.assertj : assertj-core jar 3.19.0
org.jboss.resteasy : resteasy-jaxrs jar 3.15.1.Final
org.jboss.resteasy : resteasy-undertow jar 3.15.1.Final
org.jboss.resteasy : resteasy-json-binding-provider jar 3.15.1.Final
org.glassfish.jaxb : jaxb-runtime jar 2.3.2
org.hibernate.validator : hibernate-validator jar 6.2.0.Final
org.glassfish.web : javax.el jar 2.2.6
ch.qos.logback : logback-classic jar 1.2.3
com.github.t1 : jee-testcontainers jar 1.5.6

Модули Проекта

Данный проект не имеет модулей.

Problem Detail badge badge

Abstract

Map standard and custom exceptions to a http response body containing problem details as specified in RFC-7807.

Most things work out of the box: the type and title fields are derived from the exception class name; the detail field is the message of the exception; the instance field is a random UUID URN that is also logged together with the complete stack trace.

These defaults can be overridden with annotations.

Motivation

Spring

Spec & API

  • MUST application/problem+json, application/problem+xml; SHOULD any, e.g. +yaml

  • SHOULD render text/html

  • map also @Valid REST params

  • logging: 4xx = DEBUG, 5xx = ERROR; configurable?

  • order of extensions is alphabetic (which is better for tests than random)

  • multiple extensions with the same name: undefined behavior

  • JAXB can’t unmarshal a subclass with the same type and namespace

  • Security considerations: nothing dangerous in problem details (i.e. exception message); stack-trace in logs

Dummy-Impl [ri]

It’s called ri, but it’s actually only a POC, and it’s incomplete. See the README for details.

Test

The test module runs integration tests by using JEE Testcontainers, i.e. it can be configured to start different Docker containers with various JEE application servers. By default, it starts a Wildfly.

testcontainer-running

As the containers don’t yet implement the API by themselves, the dummy implementation ri is hard-wired in the tests for now.

Wildfly

Default mvn or explicitly mvn -Djee-testcontainer=wildfly

Open Liberty

mvn -Djee-testcontainer=open-liberty:19.0.0.9-javaee8-java11 -Pwith-slf4j

needs tag for jdk11 support needs dependencies on slf4j-api and slf4j-jdk14

TomEE

mvn -Djee-testcontainer=tomee

3 tests fail, because this version of TomEE (9.0.20 / 8.0.0-M3) doesn’t write the problem detail response entity in some cases for some reason: StandardExceptionMappingIT.shouldMapWebApplicationExceptionWithoutEntityButMessage StandardExceptionMappingIT.shouldMapWebApplicationExceptionWithoutEntityOrMessage ValidationFailedExceptionMappingIT.shouldMapValidationFailedException

Payara

mvn -Djee-testcontainer=payara -Pwith-slf4j

fails due to lack of jdk11 support of the payara image. needs dependencies on slf4j-api and slf4j-jdk14

Версии библиотеки

Версия
1.0.9