Commit 4508e43d authored by unknown's avatar unknown
Browse files

Added 2 famous people to the QueryProcessor, and respective tests.

parent f77e4123
Pipeline #170876 passed with stages
in 44 seconds
......@@ -17,6 +17,23 @@ public class QueryProcessor {
"his works of hard science fiction and popular science. \n");
results.append(System.lineSeparator());
}
if (query.toLowerCase().contains("turing")) {
results.append("Alan Mathison Turing OBE FRS (23 June 1912 – 7 June 1954) was an\n" +
" English mathematician, computer scientist, logician, cryptanalyst, philosopher, \n" +
"and theoretical biologist.[6][7] Turing was highly influential in the development \n" +
"of theoretical computer science, providing a formalisation of the concepts of algorithm\n" +
" and computation with the Turing machine, which can be considered a model of a general-purpose\n" +
" computer. Turing is widely considered to be the father of theoretical computer science \n" +
"and artificial intelligence.\n");
results.append(System.lineSeparator());
}
if (query.toLowerCase().contains("neumann")) {
results.append("John von Neumann (December 28, 1903 – February 8, 1957) was a Hungarian-American\n" +
" mathematician, physicist, computer scientist, engineer and polymath. Von Neumann was generally\n" +
" regarded as the foremost mathematician of his time[2] and said to be \"the last representative\n" +
" of the great mathematicians\". He integrated pure and applied sciences.\n");
results.append(System.lineSeparator());
}
return results.toString();
}
}
......@@ -25,6 +25,16 @@ public class QueryProcessorTest {
assertThat(queryProcessor.process("Asimov"), containsString("science fiction"));
}
@Test
public void knowsAboutTuring() throws Exception {
assertThat(queryProcessor.process("turing"), containsString("Turing machine"));
}
@Test
public void knowsAboutNeumann() throws Exception {
assertThat(queryProcessor.process("neumann"), containsString("pure and applied sciences"));
}
@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