### Question:
ValidationFilter implements Filter { protected static String nearString(String strIn, int lineNum, int colNum) { String out = ""; StringBuilder sb = new StringBuilder(); String line; String lineOut; List<String> lines; int i; int last_i; lines = lineSplit(strIn); last_i = lines.size() - 1; for (i = lineNum; i <= last_i; i++) { lineOut = lines.get(i); if (i == lineNum) { if (colNum > lineOut.length()) { continue; } lineOut = lineOut.substring(colNum); } if (i != last_i) { lineOut = String.format("%s\n", lineOut); } sb.append(lineOut); } out = sb.toString(); return out; }  @Override void init(FilterConfig config); @Override void doFilter(ServletRequest sr, ServletResponse sr1, FilterChain fc); @Override void destroy(); boolean isHeaderTrue(HttpServletRequest hreq, String name); static Object xml2pojo(String xml, JAXBContext ctx, Schema schema, XmlValidationExceptionHandler errHandler); static String pojo2xml(Object pojo, JAXBContext ctx, Schema schema); static List<String> lineSplit(String strIn); static String getExtendedStackTrace(Throwable th); FilterConfig getConfig(); void setConfig(FilterConfig config); String getpPkg(); void setpPkg(String pPkg); String getpXSD(); void setpXSD(String pXSD); String getfPkg(); void setfPkg(String fPkg); String getfXSD(); void setfXSD(String fXSD); JAXBContext getpCtx(); void setpCtx(JAXBContext pCtx); JAXBContext getfCtx(); void setfCtx(JAXBContext fCtx); Schema getpSchema(); void setpSchema(Schema pSchema); Schema getfSchema(); void setfSchema(Schema fSchema); static final int BUFFSIZE; static final int BADREQ; static final String dashline; static final Pattern jsonUriPattern; static final Pattern xmlUriPattern; }### Answer:
@Test public void testnearString() { String testStr = "\nA1234567890\nB1234567890\nC1234567890\n\nE1234567890"; Assert.assertEquals(testStr, ValidationFilter.nearString(testStr, 0, 0)); Assert.assertEquals("890\nB1234567890\nC1234567890\n\nE1234567890", ValidationFilter.nearString(testStr, 1, 8)); Assert.assertEquals("90", ValidationFilter.nearString(testStr, 5, 9)); Assert.assertEquals("", ValidationFilter.nearString("abc", 5, 1)); Assert.assertEquals("\n12345\n12345\n", ValidationFilter.nearString("12345\n12345\n12345\n12345\n", 1, 5)); }