Package org.robolectric.plugins
Class DefaultSdkProvider.DefaultSdk
- java.lang.Object
-
- org.robolectric.pluginapi.Sdk
-
- org.robolectric.plugins.DefaultSdkProvider.DefaultSdk
-
- All Implemented Interfaces:
Comparable<Sdk>
- Enclosing class:
- DefaultSdkProvider
public class DefaultSdkProvider.DefaultSdk extends Sdk
Represents an Android SDK stored at Maven Central.
-
-
Constructor Summary
Constructors Constructor Description DefaultSdk(int apiLevel, String androidVersion, String robolectricVersion, String codeName, int requiredJavaVersion)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetAndroidCodeName()Returns the Android codename for this SDK.StringgetAndroidVersion()Returns the Android Version for this SDK.PathgetJarPath()Returns the path to jar for this SDK.StringgetUnsupportedMessage()Returns a human-readable message explaining why this SDK isn't supported.booleanisSupported()Determines if this SDK is supported in the running Robolectric environment.voidverifySupportedSdk(String testClassName)Verify that the SDK is supported.
-
-
-
Method Detail
-
getAndroidVersion
public String getAndroidVersion()
Description copied from class:SdkReturns the Android Version for this SDK.It should match the version reported by
android.os.Build.VERSION.RELEASEprovided within.If this is an expensive operation, the implementation should cache the return value.
- Specified by:
getAndroidVersionin classSdk- See Also:
- Android build numbers
-
getAndroidCodeName
public String getAndroidCodeName()
Description copied from class:SdkReturns the Android codename for this SDK.It should match the version reported by
android.os.Build.VERSION.CODENAMEprovided within.If this is an expensive operation, the implementation should cache the return value.
- Specified by:
getAndroidCodeNamein classSdk
-
getJarPath
public Path getJarPath()
Description copied from class:SdkReturns the path to jar for this SDK.- Specified by:
getJarPathin classSdk
-
isSupported
public boolean isSupported()
Description copied from class:SdkDetermines if this SDK is supported in the running Robolectric environment. An SDK might be unsupported if e.g. it requires a newer version of the JVM than is currently running. Unsupported SDKs should throw some explanatory exception whenSdk.getJarPath()is invoked. If this is an expensive operation, the implementation should cache the return value.- Specified by:
isSupportedin classSdk
-
getUnsupportedMessage
public String getUnsupportedMessage()
Description copied from class:SdkReturns a human-readable message explaining why this SDK isn't supported. If this is an expensive operation, the implementation should cache the return value.- Specified by:
getUnsupportedMessagein classSdk
-
verifySupportedSdk
public void verifySupportedSdk(String testClassName)
Description copied from class:SdkVerify that the SDK is supported.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.
- Specified by:
verifySupportedSdkin classSdk
-
-