private static void assertDecoration(FooService inner, HttpService outer) throws Exception {

        // Test if Service.as() works as expected.
        assertThat(outer.as(serviceType(inner))).isSameAs(inner);
        assertThat(outer.as(serviceType(outer))).isSameAs(outer);
        assertThat(outer.as(String.class)).isNull();

        // Test if FooService.serviceAdded() is invoked.
        final ServiceConfig cfg =
                new ServiceConfig(Route.ofCatchAll(), Route.ofCatchAll(),
                                  outer, /* defaultServiceName */ null,
                                  ServiceNaming.of("FooService"), /* defaultLogName */ null,
                                  1, 1, true,
                                  AccessLogWriter.disabled(),
                                  CommonPools.blockingTaskExecutor(),
                                  SuccessFunction.always(),
                                  0, Files.newTemporaryFolder().toPath(),
                                  MultipartRemovalStrategy.ON_RESPONSE_COMPLETION, CommonPools.workerGroup(),
                                  ImmutableList.of(), HttpHeaders.of(),
                                  ctx -> RequestId.of(1L),
                                  ServerErrorHandler.ofDefault().asServiceErrorHandler(), NOOP_CONTEXT_HOOK);
        outer.serviceAdded(cfg);
        assertThat(inner.cfg).isSameAs(cfg);
    }
Tests if a user can write a decorator with working as() and serviceAdded() using lambda expressions only.
core/src/test/java/com/linecorp/armeria/server/ServiceTest.java