Util { public static boolean isLocalHost(final String host) { return (host != null) && (host.equals(LOCALHOST_IP) || host.equals(LOCALHOST_NAME)); }  static String getStackTrace(final Throwable throwable); static boolean isLocalHost(final String host); static boolean isValidURI(String uri); static boolean isVariable(final byte[] value); static boolean isVariable(final Value value); static Iterator<Statement> parseAsIterator(final InputStream stream, final RDFFormat format); static List<Statement> parseAsList(final InputStream stream, final RDFFormat format); static List<Statement> parseNX(final InputStream stream); static List<Statement> parseNX(final String toParse); static Iterator<Statement> parseNXAsIterator(final InputStream stream); static List<Statement> parseXML(final InputStream stream); static List<Statement> parseXML(final String toParse); static Iterator<Statement> parseXMLAsIterator(final InputStream stream); static long parseXMLSchemaDateTimeAsMSecs(final Literal lit); static byte[][] reorderQuad(final byte[][] nodes, final int[] map); static byte[][] reorderQuadReverse(final byte[][] in, final int[] map); static byte[][] reorderTriple(final byte[][] nodes, final int[] map); static byte[][] reorderTripleReverse(final byte[][] in, final int[] map); static Iterator<T> singletonIterator(final T item); static Iterator<T> toResultIterator(final RepositoryResult<T> result); static Value[] toValueArray(Statement stmt); static final Predicate<Value[]> ALL_CONSTANTS; static final Predicate<byte[][]> ALL_CONSTANTS_WITH_IDS; static final Predicate<Value[]> ALL_VARS; static final Predicate<Value[]> CONTAINS_VAR; }
@Test public void isLocalhost() { assertTrue(Util.isLocalHost(Util.LOCALHOST_IP)); assertTrue(Util.isLocalHost(Util.LOCALHOST_NAME)); assertFalse(Util.isLocalHost(Util.LOCALHOST_IP.replaceAll("0", String.valueOf(TestUtils.RANDOMIZER.nextInt(255))))); assertFalse(Util.isLocalHost(String.valueOf(System.currentTimeMillis()))); }