Browsed by
Month: October 2022

Testing a Java Google Cloud Function

Testing a Java Google Cloud Function

Until recently, testing a Google Cloud Function written in Java could be done via the invoker provided by the Google Cloud Functions SDK but not via a unit test. But this changed recently! Let’s take the following HTTP function as an example: public class HelloHttpFunction implements HttpFunction { @Override public void service(HttpRequest httpRequest, HttpResponse httpResponse) throws Exception { Writer writer = httpResponse.getWriter(); writer.write(“Hello World”); } } After packaging the function into an über JAR, we can download the Google Cloud…

Read More Read More