Commit da27674d authored by Qianyi Shu's avatar Qianyi Shu
Browse files
parents 41814de1 9d159196
Pipeline #63088 canceled with stages
in 58 minutes and 28 seconds
......@@ -59,3 +59,4 @@
</plugins>
</build>
</project>
......@@ -17,6 +17,19 @@ public class QueryProcessor {
"his works of hard science fiction and popular science. \n");
results.append(System.lineSeparator());
}
if (query.toLowerCase().contains("rory shu")) {
results.append("Rory Shu (9 March 1998 - ) is a Chinese JMC undergraduate\n" +
"living in London, famous for having a annoying bf (and his friend is\n"
+ "annoying too).\n");
results.append(System.lineSeparator());
}
if (query.toLowerCase().contains("nanfeng liu")) {
results.append("Nanfeng Liu (10 December 1998 - ) is a Chinese Computing undergraduate\n" +
"living in London. \n");
results.append(System.lineSeparator());
}
return results.toString();
}
}
......@@ -27,6 +27,10 @@ public class WebServer {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
String query = req.getParameter("q");
String type = req.getParameter("t");
if(type == "markdown"){
System.out.println("Is a mark down!");
}
if (query == null) {
new IndexPage().writeTo(resp);
} else {
......
......@@ -21,6 +21,11 @@ public class IndexPage implements Page {
"<p>Enter your query in the box below: " +
"<form>" +
"<input type=\"text\" name=\"q\" />" +
"<form action=\"\">" +
" <input type=\"radio\" name=\"t\" value=\"markdown\"> markdown<br>"+
// "<input type=\"radio\" name=\"gender\" value=\"female\"> Female<br>"+
// "<input type=\"radio\" name=\"gender\" value=\"other\"> Other"+
"</form>"+
"<br><br><input type=\"submit\">" +
"</form>" +
"</p>");
......
......@@ -25,8 +25,20 @@ public class QueryProcessorTest {
assertThat(queryProcessor.process("Asimov"), containsString("science fiction"));
}
@Test
public void knowsAboutRory() throws Exception {
assertThat(queryProcessor.process("rory shu"), containsString("JMC"));
}
@Test
public void knowsAboutNanfeng() throws Exception {
assertThat(queryProcessor.process("nanfeng liu"), containsString("Computing"));
}
@Test
public void isNotCaseSensitive() throws Exception {
assertThat(queryProcessor.process("shakespeare"), containsString("playwright"));
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment