Simple functional test in java
import org.junit.Before;
import org.junit.Test;
import br.techhit.scanydrive.helpers.LoginHelper;
import static org.junit.Assert.*;
public class LoginHelperTest {
LoginHelper loginHelper;
@Before
public void setUp() {
loginHelper = new LoginHelper();
}
@Test
public void isValidIpAddressTest() {
assertEquals(true, loginHelper.isValidIpAddress("127.0.0.1"));
assertEquals(true, loginHelper.isValidIpAddress("192.168.2.15"));
}
@Test
public void isNotValidIpAddressTest() {
assertEquals(false, loginHelper.isValidIpAddress("40"));
assertEquals(false, loginHelper.isValidIpAddress("www.google.com.br"));
}
}