ThingNotDeletableException extends DittoRuntimeException implements ThingException { public static Builder newBuilder(final ThingId thingId) { return new Builder(thingId); } private  ThingNotDeletableException(final DittoHeaders dittoHeaders,
            @Nullable final String message,
            @Nullable final String description,
            @Nullable final Throwable cause,
            @Nullable final URI href); static Builder newBuilder(final ThingId thingId); static ThingNotDeletableException fromMessage(@Nullable final String message,
            final DittoHeaders dittoHeaders); static ThingNotDeletableException fromJson(final JsonObject jsonObject,
            final DittoHeaders dittoHeaders); static final String ERROR_CODE; }
@Test public void checkMessageV1() { final ThingId thingId = ThingId.of("foo", "bar"); final DittoRuntimeException createdException = ThingNotDeletableException.newBuilder(thingId) .dittoHeaders(DittoHeaders.newBuilder().schemaVersion(JsonSchemaVersion.V_1).build()) .build(); final String expectedMessage = "The Thing with ID '"+thingId.toString()+ "' could not be deleted as the " + "requester had insufficient permissions ( WRITE and ADMINISTRATE are required)."; assertThat(createdException.getMessage()).isEqualTo(expectedMessage); }
@Test public void checkMessageV2() { final ThingId thingId = ThingId.of("foo", "bar"); final DittoRuntimeException createdException = ThingNotDeletableException.newBuilder(thingId) .dittoHeaders(DittoHeaders.newBuilder().schemaVersion(JsonSchemaVersion.V_2).build()) .build(); final String expectedMessage = "The Thing with ID '"+thingId.toString()+"' could not be deleted as the " + "requester had insufficient permissions ( WRITE on root resource is required)."; assertThat(createdException.getMessage()).isEqualTo(expectedMessage); }