@Test public void isAlphaNumericTest() { try { Method method = ElkConnectorImpl.class.getDeclaredMethod("isAlphaNumeric", String.class); method.setAccessible(true); assertTrue((boolean) method.invoke(new ElkConnectorImpl(), "abc123")); assertFalse((boolean) method.invoke(new ElkConnectorImpl(), "abc123*")); assertFalse((boolean) method.invoke(new ElkConnectorImpl(), "abc123{}")); assertFalse((boolean) method.invoke(new ElkConnectorImpl(), "abc123\n")); assertFalse((boolean) method.invoke(new ElkConnectorImpl(), "abc123<")); assertFalse((boolean) method.invoke(new ElkConnectorImpl(), "abc123:")); } catch (Exception e) { fail(); } }
private boolean isAlphaNumeric(String query) { return query.matches("[a-zA-Z_0-9]+"); }
ElkConnectorImpl implements ElkConnector { private boolean isAlphaNumeric(String query) { return query.matches("[a-zA-Z_0-9]+"); } }
ElkConnectorImpl implements ElkConnector { private boolean isAlphaNumeric(String query) { return query.matches("[a-zA-Z_0-9]+"); } ElkConnectorImpl(); }
ElkConnectorImpl implements ElkConnector { private boolean isAlphaNumeric(String query) { return query.matches("[a-zA-Z_0-9]+"); } ElkConnectorImpl(); @Override JestResult search(PolicyIndexType type, String text); @Override JestResult search(PolicyIndexType type, String text, Map<String, String> filter_s); boolean put(PolicyRestAdapter policyData); @Override boolean delete(PolicyRestAdapter policyData); @Override boolean update(PolicyRestAdapter policyData); }
ElkConnectorImpl implements ElkConnector { private boolean isAlphaNumeric(String query) { return query.matches("[a-zA-Z_0-9]+"); } ElkConnectorImpl(); @Override JestResult search(PolicyIndexType type, String text); @Override JestResult search(PolicyIndexType type, String text, Map<String, String> filter_s); boolean put(PolicyRestAdapter policyData); @Override boolean delete(PolicyRestAdapter policyData); @Override boolean update(PolicyRestAdapter policyData);  }