Navigation Menu

Skip to content

Commit

Permalink
fix: Address function_ent comments around naming and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
grant committed Aug 23, 2019
1 parent 11cb8da commit b47c2f9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Expand Up @@ -20,8 +20,14 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class Env {
public void env(HttpServletRequest request, HttpServletResponse response)
public class EnvVars {
/**
* Returns the environment variable "foo" set during function deployment.
* @param request The Servlet HTTP request.
* @param response The Servlet HTTP response.
* @throws IOException If there is an I/O writer exception.
*/
public void envVar(HttpServletRequest request, HttpServletResponse response)
throws IOException {
PrintWriter writer = response.getWriter();
String foo = System.getenv("FOO");
Expand Down
5 changes: 3 additions & 2 deletions functions/snippets/src/test/java/SnippetsTests.java
Expand Up @@ -162,7 +162,8 @@ public void helloBackgroundTest() throws IOException {

@Test
public void envTest() throws IOException {
new Env().env(request, response);
assertThat(responseOut.toString(), containsString(""));
new EnvVars().envVar(request, response);
when(System.getenv("FOO")).thenReturn("BAR");
assertThat(responseOut.toString(), containsString("BAR"));
}
}

0 comments on commit b47c2f9

Please sign in to comment.