Code example for UnknownHostException

Methods: getMessage

0
 
	public void testGetInetAddress() { 
		try { 
			Assert.assertEquals(expectedAdress, mDev.getInetAddress().getHostAddress());
		} catch (UnknownHostException e) {
			Assert.fail(e.getMessage());
		} 
	} 
 
	public void testSetInetAdress() { 
		String expectedNewIP = "10.10.10.11";
		 
		try { 
			// test value 
			mDev.setInetAddress(InetAddress.getByName(expectedNewIP));
			Assert.assertEquals(expectedNewIP, mDev.getInetAddress().getHostAddress());
			 
			// test loopback 
			mDev.setInetAddress(InetAddress.getByName(null));
			Assert.assertEquals(expectedNewIP, mDev.getInetAddress().getHostAddress());