@Test public void onHttpCommand_FilterHttpNoise(){ String httpCommand = "GET /startTask%20%5BBRUNDLE-1632%5D HTTP/1.1"; CommandLineInterfaceMock delegate = new CommandLineInterfaceMock(); CommandLineInterface subject = new HttpFilterCommandLineInterface(delegate) ; subject.command(httpCommand); Assert.assertEquals("startTask [BRUNDLE-1632]", delegate.getCommand()); }
@Override public String command(String command) { String filtered = command.replaceAll("GET /", ""); filtered = filtered.replaceAll(" HTTP/1.1", ""); filtered = filtered.replaceAll("%5B", "["); filtered = filtered.replaceAll("%5D", "]"); filtered = filtered.replaceAll("%20", " "); return delegate.command(filtered); }
HttpFilterCommandLineInterface implements CommandLineInterface { @Override public String command(String command) { String filtered = command.replaceAll("GET /", ""); filtered = filtered.replaceAll(" HTTP/1.1", ""); filtered = filtered.replaceAll("%5B", "["); filtered = filtered.replaceAll("%5D", "]"); filtered = filtered.replaceAll("%20", " "); return delegate.command(filtered); } }
HttpFilterCommandLineInterface implements CommandLineInterface { @Override public String command(String command) { String filtered = command.replaceAll("GET /", ""); filtered = filtered.replaceAll(" HTTP/1.1", ""); filtered = filtered.replaceAll("%5B", "["); filtered = filtered.replaceAll("%5D", "]"); filtered = filtered.replaceAll("%20", " "); return delegate.command(filtered); } HttpFilterCommandLineInterface(CommandLineInterface delegate); }
HttpFilterCommandLineInterface implements CommandLineInterface { @Override public String command(String command) { String filtered = command.replaceAll("GET /", ""); filtered = filtered.replaceAll(" HTTP/1.1", ""); filtered = filtered.replaceAll("%5B", "["); filtered = filtered.replaceAll("%5D", "]"); filtered = filtered.replaceAll("%20", " "); return delegate.command(filtered); } HttpFilterCommandLineInterface(CommandLineInterface delegate); @Override String command(String command); }
HttpFilterCommandLineInterface implements CommandLineInterface { @Override public String command(String command) { String filtered = command.replaceAll("GET /", ""); filtered = filtered.replaceAll(" HTTP/1.1", ""); filtered = filtered.replaceAll("%5B", "["); filtered = filtered.replaceAll("%5D", "]"); filtered = filtered.replaceAll("%20", " "); return delegate.command(filtered); } HttpFilterCommandLineInterface(CommandLineInterface delegate); @Override String command(String command);  }