use of org.eclipse.hono.util.TenantConstants in project hono by eclipse.
the class BaseTenantServiceTest method testAddFailsForAdapterConfigWithoutType.
/**
* Verifies that the base service fails for a payload that defines an adapter entry, but does not provide the
* mandatory field {@link TenantConstants#FIELD_ADAPTERS_TYPE}.
*
* @param ctx The vert.x test context.
*/
@Test
public void testAddFailsForAdapterConfigWithoutType(final TestContext ctx) {
final JsonObject testPayload = createValidTenantPayload();
final JsonArray adapterArray = new JsonArray();
// no type specified (which is a violation of the API)
adapterArray.add(new JsonObject());
testPayload.put(TenantConstants.FIELD_ADAPTERS, adapterArray);
final EventBusMessage msg = createRequest(TenantConstants.TenantAction.add, testPayload);
tenantService.processRequest(msg).setHandler(ctx.asyncAssertFailure(t -> {
ctx.assertEquals(HttpURLConnection.HTTP_BAD_REQUEST, ((ServiceInvocationException) t).getErrorCode());
}));
}
Aggregations