Comparable<Sdk>
DefaultSdkProvider.DefaultSdk
public abstract class Sdk extends Object implements Comparable<Sdk>
Modifier | Constructor | Description |
---|---|---|
protected |
Sdk(int apiLevel) |
Modifier and Type | Method | Description |
---|---|---|
int |
compareTo(Sdk o) |
Instances of
Sdk are ordered by the API level they implement. |
boolean |
equals(Object o) |
|
abstract String |
getAndroidCodeName() |
Returns the Android codename for this SDK.
|
abstract String |
getAndroidVersion() |
Returns the Android Version for this SDK.
|
int |
getApiLevel() |
Returns the Android API level for this SDK.
|
abstract Path |
getJarPath() |
Returns the path to jar for this SDK.
|
abstract String |
getUnsupportedMessage() |
Returns a human-readable message explaining why this SDK isn't supported.
|
int |
hashCode() |
|
boolean |
isKnown() |
Determines if this SDK is known by its provider.
|
abstract boolean |
isSupported() |
Determines if this SDK is supported in the running Robolectric environment.
|
String |
toString() |
|
abstract void |
verifySupportedSdk(String testClassName) |
Verify that the SDK is supported.
|
public final int getApiLevel()
It must match the version reported by android.os.Build.VERSION.SDK_INT
provided
within.
public abstract String getAndroidVersion()
It should match the version reported by android.os.Build.VERSION.RELEASE
provided
within.
If this is an expensive operation, the implementation should cache the return value.
public abstract String getAndroidCodeName()
It should match the version reported by android.os.Build.VERSION.CODENAME
provided
within.
If this is an expensive operation, the implementation should cache the return value.
public abstract Path getJarPath()
public abstract boolean isSupported()
getJarPath()
is invoked.
If this is an expensive operation, the implementation should cache the return value.public abstract String getUnsupportedMessage()
public boolean isKnown()
getJarPath()
is invoked.public int compareTo(@Nonnull Sdk o)
Sdk
are ordered by the API level they implement.compareTo
in interface Comparable<Sdk>
public abstract void verifySupportedSdk(String testClassName)
Implementations should throw an exception if SDK is unsupported. They can choose to either throw org.junit.AssumptionViolatedException to just skip execution of tests on the SDK, with a warning, or throw a RuntimeException to fail the test.
testClassName
-