|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjunit.framework.Assert
junit.framework.TestCase
com.android.testutils.SdkTestCase
com.android.tools.lint.checks.infrastructure.LintDetectorTest
@Beta public abstract class LintDetectorTest
Test case for lint detectors.
NOTE: This is not a public or final API; if you rely on this be prepared to adjust your code for the next tools release.
Nested Class Summary | |
---|---|
class |
LintDetectorTest.BinaryTestFile
|
static class |
LintDetectorTest.BytecodeProducer
|
static class |
LintDetectorTest.ByteProducer
Produces byte arrays, for use with LintDetectorTest.BinaryTestFile |
class |
LintDetectorTest.CustomIssueRegistry
|
class |
LintDetectorTest.JarTestFile
|
class |
LintDetectorTest.ManifestTestFile
|
class |
LintDetectorTest.PropertyTestFile
|
class |
LintDetectorTest.TestConfiguration
|
class |
LintDetectorTest.TestLintClient
|
Nested classes/interfaces inherited from class com.android.testutils.SdkTestCase |
---|
com.android.testutils.SdkTestCase.TestFile |
Field Summary |
---|
Fields inherited from class com.android.testutils.SdkTestCase |
---|
sCleanDirs |
Constructor Summary | |
---|---|
LintDetectorTest()
|
Method Summary | |
---|---|
protected boolean |
allowCompilationErrors()
|
LintDetectorTest.BinaryTestFile |
base64(java.lang.String to,
java.lang.String encoded)
Creates a test file from the given base64 data. |
LintDetectorTest.BinaryTestFile |
bytecode(java.lang.String to,
LintDetectorTest.BytecodeProducer producer)
|
protected java.lang.String |
checkLint(LintDetectorTest.TestLintClient lintClient,
java.util.List<java.io.File> files)
|
protected java.lang.String |
checkLint(java.util.List<java.io.File> files)
|
protected void |
checkReportedError(com.android.tools.lint.detector.api.Context context,
com.android.tools.lint.detector.api.Issue issue,
com.android.tools.lint.detector.api.Severity severity,
com.android.tools.lint.detector.api.Location location,
java.lang.String message)
|
protected void |
configureDriver(com.android.tools.lint.client.api.LintDriver driver)
|
com.android.testutils.SdkTestCase.TestFile |
copy(java.lang.String from)
|
com.android.testutils.SdkTestCase.TestFile |
copy(java.lang.String from,
java.lang.String to)
|
protected LintDetectorTest.TestLintClient |
createClient()
|
com.android.testutils.SdkTestCase.TestFile |
file()
|
protected LintDetectorTest.TestConfiguration |
getConfiguration(com.android.tools.lint.client.api.LintClient client,
com.android.tools.lint.detector.api.Project project)
|
protected abstract com.android.tools.lint.detector.api.Detector |
getDetector()
|
protected com.android.tools.lint.detector.api.Detector |
getDetectorInstance()
|
protected abstract java.util.List<com.android.tools.lint.detector.api.Issue> |
getIssues()
|
protected java.util.EnumSet<com.android.tools.lint.detector.api.Scope> |
getLintScope(java.util.List<java.io.File> file)
|
protected java.io.File |
getProjectDir(java.lang.String name,
com.android.testutils.SdkTestCase.TestFile... testFiles)
Creates a project directory structure from the given files |
protected java.io.File |
getProjectDir(java.lang.String name,
java.lang.String... relativePaths)
Creates a project directory structure from the given files |
protected java.io.File |
getRootDir()
Returns the Android source tree root dir. |
java.lang.String |
getSuperClass(com.android.tools.lint.detector.api.Project project,
java.lang.String name)
|
protected java.io.File |
getTargetDir()
|
protected java.io.InputStream |
getTestResource(java.lang.String relativePath,
boolean expectExists)
|
protected boolean |
ignoreSystemErrors()
|
protected boolean |
includeParentPath()
|
protected boolean |
isEnabled(com.android.tools.lint.detector.api.Issue issue)
|
LintDetectorTest.JarTestFile |
jar(java.lang.String to)
|
LintDetectorTest.JarTestFile |
jar(java.lang.String to,
com.android.testutils.SdkTestCase.TestFile... files)
|
com.android.testutils.SdkTestCase.TestFile |
java(java.lang.String source)
|
com.android.testutils.SdkTestCase.TestFile |
java(java.lang.String to,
java.lang.String source)
|
protected java.lang.String |
lintFiles(java.lang.String... relativePaths)
|
protected java.lang.String |
lintProject(com.android.testutils.SdkTestCase.TestFile... files)
Run lint on the given files when constructed as a separate project |
protected java.lang.String |
lintProject(java.lang.String... relativePaths)
Run lint on the given files when constructed as a separate project |
protected java.lang.String |
lintProjectIncrementally(java.lang.String currentFile,
com.android.testutils.SdkTestCase.TestFile... files)
|
protected java.lang.String |
lintProjectIncrementally(java.lang.String currentFile,
java.lang.String... relativePaths)
|
LintDetectorTest.ManifestTestFile |
manifest()
|
LintDetectorTest.PropertyTestFile |
projectProperties()
|
protected void |
setUp()
|
com.android.testutils.SdkTestCase.TestFile |
source(java.lang.String to,
java.lang.String source)
|
protected void |
tearDown()
|
static java.lang.String |
toBase64(byte[] bytes)
|
static java.lang.String |
toBase64(java.io.File file)
|
com.android.testutils.SdkTestCase.TestFile |
xml(java.lang.String to,
java.lang.String source)
|
Methods inherited from class com.android.testutils.SdkTestCase |
---|
addCleanupDir, addSelection, assertEqualsGolden, assertEqualsGolden, cleanup, deleteFile, findSrcDir, findSrcRelativeDir, getCaretContext, getCaretOffset, getDiff, getDiff, getTempDir, getTestDataRelPath, getTestfile, makeTestFile, makeTestFile, readTestFile, removeSessionData |
Methods inherited from class junit.framework.TestCase |
---|
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public LintDetectorTest()
Method Detail |
---|
protected void setUp() throws java.lang.Exception
setUp
in class junit.framework.TestCase
java.lang.Exception
protected void tearDown() throws java.lang.Exception
tearDown
in class junit.framework.TestCase
java.lang.Exception
protected abstract com.android.tools.lint.detector.api.Detector getDetector()
protected final com.android.tools.lint.detector.api.Detector getDetectorInstance()
protected boolean allowCompilationErrors()
protected abstract java.util.List<com.android.tools.lint.detector.api.Issue> getIssues()
protected java.lang.String lintFiles(java.lang.String... relativePaths) throws java.lang.Exception
java.lang.Exception
protected java.lang.String checkLint(java.util.List<java.io.File> files) throws java.lang.Exception
java.lang.Exception
protected java.lang.String checkLint(LintDetectorTest.TestLintClient lintClient, java.util.List<java.io.File> files) throws java.lang.Exception
java.lang.Exception
protected void checkReportedError(@NonNull com.android.tools.lint.detector.api.Context context, @NonNull com.android.tools.lint.detector.api.Issue issue, @NonNull com.android.tools.lint.detector.api.Severity severity, @Nullable com.android.tools.lint.detector.api.Location location, @NonNull java.lang.String message)
protected LintDetectorTest.TestLintClient createClient()
protected LintDetectorTest.TestConfiguration getConfiguration(com.android.tools.lint.client.api.LintClient client, com.android.tools.lint.detector.api.Project project)
protected void configureDriver(com.android.tools.lint.client.api.LintDriver driver)
protected java.lang.String lintProject(java.lang.String... relativePaths) throws java.lang.Exception
java.lang.Exception
protected java.lang.String lintProjectIncrementally(java.lang.String currentFile, java.lang.String... relativePaths) throws java.lang.Exception
java.lang.Exception
protected java.lang.String lintProjectIncrementally(java.lang.String currentFile, com.android.testutils.SdkTestCase.TestFile... files) throws java.lang.Exception
java.lang.Exception
protected java.lang.String lintProject(com.android.testutils.SdkTestCase.TestFile... files) throws java.lang.Exception
java.lang.Exception
protected java.io.File getTargetDir()
getTargetDir
in class com.android.testutils.SdkTestCase
@NonNull public com.android.testutils.SdkTestCase.TestFile file()
@NonNull public com.android.testutils.SdkTestCase.TestFile source(@NonNull java.lang.String to, @NonNull java.lang.String source)
@NonNull public com.android.testutils.SdkTestCase.TestFile java(@NonNull java.lang.String to, @NonNull java.lang.String source)
@NonNull public com.android.testutils.SdkTestCase.TestFile java(@NonNull java.lang.String source)
@NonNull public com.android.testutils.SdkTestCase.TestFile xml(@NonNull java.lang.String to, @NonNull java.lang.String source)
@NonNull public com.android.testutils.SdkTestCase.TestFile copy(@NonNull java.lang.String from, @NonNull java.lang.String to)
@NonNull public LintDetectorTest.ManifestTestFile manifest()
@NonNull public LintDetectorTest.PropertyTestFile projectProperties()
@NonNull public LintDetectorTest.BinaryTestFile bytecode(@NonNull java.lang.String to, @NonNull LintDetectorTest.BytecodeProducer producer)
public static java.lang.String toBase64(@NonNull byte[] bytes)
public static java.lang.String toBase64(@NonNull java.io.File file) throws java.io.IOException
java.io.IOException
public LintDetectorTest.BinaryTestFile base64(@NonNull java.lang.String to, @NonNull java.lang.String encoded)
toBase64(File)
or toBase64(byte[])
, for example via assertEquals("",
uuencode(new File("path/to/your.class")));
to
- the file to write asencoded
- the encoded data
@NonNull public LintDetectorTest.JarTestFile jar(@NonNull java.lang.String to)
@NonNull public LintDetectorTest.JarTestFile jar(@NonNull java.lang.String to, @NonNull com.android.testutils.SdkTestCase.TestFile... files)
@NonNull public com.android.testutils.SdkTestCase.TestFile copy(@NonNull java.lang.String from)
protected java.io.File getProjectDir(java.lang.String name, java.lang.String... relativePaths) throws java.lang.Exception
java.lang.Exception
protected java.io.File getProjectDir(java.lang.String name, com.android.testutils.SdkTestCase.TestFile... testFiles) throws java.lang.Exception
java.lang.Exception
protected java.io.InputStream getTestResource(java.lang.String relativePath, boolean expectExists)
getTestResource
in class com.android.testutils.SdkTestCase
protected boolean isEnabled(com.android.tools.lint.detector.api.Issue issue)
protected boolean includeParentPath()
protected java.util.EnumSet<com.android.tools.lint.detector.api.Scope> getLintScope(java.util.List<java.io.File> file)
public java.lang.String getSuperClass(com.android.tools.lint.detector.api.Project project, java.lang.String name)
protected boolean ignoreSystemErrors()
protected java.io.File getRootDir()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |