simple test for WifiStateChangeService.formatIpAddress()
94f79a6438c7021db9c02003865c17f3a0da1718 made me want to be sure
This commit is contained in:
		
							parent
							
								
									68375163f5
								
							
						
					
					
						commit
						c947f24495
					
				| @ -229,7 +229,7 @@ public class WifiStateChangeService extends IntentService { | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     private String formatIpAddress(int ipAddress) { | ||||
|     static String formatIpAddress(int ipAddress) { | ||||
|         if (ipAddress == 0) { | ||||
|             return null; | ||||
|         } | ||||
|  | ||||
| @ -0,0 +1,20 @@ | ||||
| package org.fdroid.fdroid.net; | ||||
| 
 | ||||
| import org.junit.Test; | ||||
| 
 | ||||
| import java.net.InetAddress; | ||||
| import java.net.UnknownHostException; | ||||
| 
 | ||||
| public class WifiStateChangeServiceTest { | ||||
| 
 | ||||
|     @Test | ||||
|     public void testFormatIpAddress() throws UnknownHostException { | ||||
|         for (long i = Integer.MIN_VALUE; i <= Integer.MAX_VALUE; i += 98273) { | ||||
|             String ip = WifiStateChangeService.formatIpAddress((int) i); | ||||
|             InetAddress.getByName(ip); | ||||
|         } | ||||
|         InetAddress.getByName(WifiStateChangeService.formatIpAddress(Integer.MAX_VALUE)); | ||||
|         InetAddress.getByName(WifiStateChangeService.formatIpAddress(Integer.MIN_VALUE)); | ||||
|         InetAddress.getByName(WifiStateChangeService.formatIpAddress(0)); | ||||
|     } | ||||
| } | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Hans-Christoph Steiner
						Hans-Christoph Steiner