
org.robolectric.shadows.ShadowInetAddressUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of shadows-framework Show documentation
Show all versions of shadows-framework Show documentation
An alternative Android testing framework.
The newest version!
package org.robolectric.shadows;
import android.os.Build;
import java.net.InetAddress;
import java.net.UnknownHostException;
import libcore.net.InetAddressUtils;
import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;
/** Shadow InetAddressUtils class that doesn't use native Libcore function. */
@Implements(value = InetAddressUtils.class, minSdk = Build.VERSION_CODES.Q, isInAndroidSdk = false)
public class ShadowInetAddressUtils {
@Implementation
protected static InetAddress parseNumericAddressNoThrow(String address) {
try {
return InetAddress.getByName(address);
} catch (UnknownHostException e) {
return null;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy