
org.robolectric.shadows.ShadowOs 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.system.Os;
import java.util.HashMap;
import java.util.Map;
import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;
/** A Shadow for android.system.Os */
@Implements(value = Os.class, minSdk = 21)
public final class ShadowOs {
private ShadowOs() {}
private static final Map sysconfValues = new HashMap<>();
/** Configures values to be returned by sysconf. */
public static void setSysconfValue(int name, long value) {
sysconfValues.put(name, value);
}
/** Returns the value configured via setSysconfValue, or -1 if one hasn't been configured. */
@Implementation
protected static long sysconf(int name) {
return sysconfValues.getOrDefault(name, -1L);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy