Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package tv.codely.mooc.controller.greeter;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

@RestController
public final class GreeterGetController {

@RequestMapping("/greeter")
public HashMap<String, String> index(@RequestParam String name) {
HashMap<String, String> resp = new HashMap<>();
String greet = "hello " + name;
resp.put("response", greet);

return resp;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package tv.codely.mooc.controller.greeter;

import org.junit.jupiter.api.Test;
import tv.codely.mooc.controller.RequestTestCase;

public final class GreeterGetControllerTest extends RequestTestCase {
@Test
public void it_should_get_a_greeter_response() throws Exception {
this.getRequest("/greeter?name=pepe", 200, "{'response': 'hello pepe'}");
}
}