net.benelog.oneftpserver.util.NetworkUtilsTest.java Source code

Java tutorial

Introduction

Here is the source code for net.benelog.oneftpserver.util.NetworkUtilsTest.java

Source

/*
 * @(#)NetworkUtilsTest.java $version 2012. 5. 15.
 *
 * Copyright 2007 NHN Corp. All rights Reserved. 
 * NHN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */

package net.benelog.oneftpserver.util;

import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;

import org.apache.commons.lang.StringUtils;
import org.junit.Test;

/**
 * @author benelog
 */
public class NetworkUtilsTest {

    @Test
    public void testGetLocalhostIp() {
        String ip = NetworkUtils.getLocalhostIp();
        int numOfDot = StringUtils.countMatches(ip, ".");
        assertThat(numOfDot, is(3));
    }
}