Skip to content

Commit

Permalink
Add @NotYetImplemented test with explanation
Browse files Browse the repository at this point in the history
  • Loading branch information
graemerocher committed May 31, 2018
1 parent 2bcf3f3 commit a7f0a38
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public AnnotatedFunctionRouteBuilder(
UriNamingStrategy uriNamingStrategy,
ConversionService<?> conversionService,
MediaTypeCodecRegistry codecRegistry,
@Value("${function.context-path:/}") String contextPath) {
@Value("${micronaut.function.context-path:/}") String contextPath) {
super(executionHandleLocator, uriNamingStrategy, conversionService);
this.localFunctionRegistry = new DefaultLocalFunctionRegistry(codecRegistry);
this.contextPath = contextPath.endsWith("/") ? contextPath : contextPath + '/';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package io.micronaut.function.web

import io.micronaut.context.ApplicationContext
import io.micronaut.http.HttpResponse
import io.micronaut.http.HttpStatus
import io.micronaut.http.client.RxHttpClient
import io.micronaut.runtime.server.EmbeddedServer
import spock.lang.Specification

class JavaLambdaFunctionSpec extends Specification {

void "test string supplier"() {
given:
EmbeddedServer embeddedServer = ApplicationContext.run(EmbeddedServer)
RxHttpClient client = embeddedServer.applicationContext.createBean(RxHttpClient, embeddedServer.getURL())

when:
HttpResponse<String> response = client.toBlocking().exchange('/java/supplier/string', String)

then:
response.code() == HttpStatus.OK.code
response.body() == 'value'

cleanup:
embeddedServer.stop()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package io.micronaut.function.web;

import io.micronaut.context.annotation.Factory;
import io.micronaut.function.FunctionBean;

import java.util.function.Supplier;

@Factory
public class TestFunctionFactory {

@FunctionBean("java/supplier/string")
Supplier<String> get() {
return () -> "myvalue";
}
}

0 comments on commit a7f0a38

Please sign in to comment.