本文整理汇总了Java中org.robolectric.bytecode.Setup类的典型用法代码示例。如果您正苦于以下问题:Java Setup类的具体用法?Java Setup怎么用?Java Setup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Setup类属于org.robolectric.bytecode包,在下文中一共展示了Setup类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createRobolectricClassLoader
import org.robolectric.bytecode.Setup; //导入依赖的package包/类
@Override protected ClassLoader createRobolectricClassLoader(Setup setup, SdkConfig sdkConfig) {
URL[] urls = getJarResolver().getLocalArtifactUrls(sdkConfig.getSdkClasspathDependencies());
return new AsmInstrumentingClassLoader(setup, urls) {
@Override protected byte[] getByteCode(String className) throws ClassNotFoundException {
if (className.startsWith("com.github.stephanenicolas.injectview")) {
try {
CtClass dummyClass = ClassPool.getDefault().get(className);
if (processor.shouldTransform(dummyClass)) {
log.debug("Intercepting via InjectView " + className);
processor.applyTransformations(dummyClass);
byte[] bytes = dummyClass.toBytecode();
System.out.println("Size of weaved byte code :" + bytes.length);
FileOutputStream fileOutputStream = new FileOutputStream("/tmp/" + className + ".class");
fileOutputStream.write(bytes);
fileOutputStream.close();
return bytes;
}
} catch (Exception e) {
throw new RuntimeException("Impossible to transform class " + className, e);
}
}
return super.getByteCode(className);
}
};
}
开发者ID:stephanenicolas,项目名称:injectview,代码行数:26,代码来源:InjectViewTestRunner.java
示例2: createRobolectricClassLoader
import org.robolectric.bytecode.Setup; //导入依赖的package包/类
@Override
protected ClassLoader createRobolectricClassLoader(Setup setup, SdkConfig sdkConfig) {
URL[] urls = getJarResolver().getLocalArtifactUrls(sdkConfig.getSdkClasspathDependencies());
return new AsmInstrumentingClassLoader(setup, urls) {
@Override
protected byte[] getByteCode(String className) throws ClassNotFoundException {
if (className.startsWith("com.github.stephanenicolas.lxglifecycle")) {
try {
CtClass dummyClass = ClassPool.getDefault().get(className);
if (processor.shouldTransform(dummyClass)) {
log.debug("Intercepting via InjectExtra " + className);
processor.applyTransformations(dummyClass);
byte[] bytes = dummyClass.toBytecode();
System.out.println("Size of weaved byte code :" + bytes.length);
FileOutputStream fileOutputStream =
new FileOutputStream("/tmp/" + className + ".class");
fileOutputStream.write(bytes);
fileOutputStream.close();
return bytes;
}
} catch (Exception e) {
throw new RuntimeException("Impossible to transform class " + className, e);
}
}
return super.getByteCode(className);
}
};
}
开发者ID:emmby,项目名称:easy-a,代码行数:29,代码来源:LxgLifeCycleTestRunner.java
示例3: createSetup
import org.robolectric.bytecode.Setup; //导入依赖的package包/类
@Override
public Setup createSetup() {
return new Setup() {
@Override
public boolean shouldInstrument(ClassInfo classInfo) {
return classInfo.getName().equals(AsyncTasks.class.getName())
|| super.shouldInstrument(classInfo);
}
};
}
开发者ID:JSafaiyeh,项目名称:Fabric-Example-App-Android,代码行数:11,代码来源:SdkTestRunner.java
示例4: createSetup
import org.robolectric.bytecode.Setup; //导入依赖的package包/类
@Override public Setup createSetup() {
return new Setup() {
@Override public boolean shouldAcquire(String name) {
if (name.equals(StateHolder.class.getName())) return false;
return super.shouldAcquire(name);
}
};
}
开发者ID:qx,项目名称:FullRobolectricTestSample,代码行数:9,代码来源:TestRunnerSequenceTest.java
示例5: createSetup
import org.robolectric.bytecode.Setup; //导入依赖的package包/类
@Override
public Setup createSetup() {
return new Setup() {
@Override
public boolean shouldInstrument(ClassInfo classInfo) {
String name = classInfo.getName();
if (name.equals(AndroidTranslatorClassInstrumentedTest.CustomPaint.class.getName())
|| name.equals(AndroidTranslatorClassInstrumentedTest.ClassWithPrivateConstructor.class.getName())) {
return true;
}
return super.shouldInstrument(classInfo);
}
};
}
开发者ID:qx,项目名称:FullRobolectricTestSample,代码行数:15,代码来源:TestRunners.java
示例6: createRobolectricClassLoader
import org.robolectric.bytecode.Setup; //导入依赖的package包/类
@Override
protected ClassLoader createRobolectricClassLoader(Setup setup, SdkConfig sdkConfig) {
URL[] urls = getJarResolver().getLocalArtifactUrls(sdkConfig.getSdkClasspathDependencies());
return new AsmInstrumentingClassLoader(setup, urls) {
@Override
protected byte[] getByteCode(String className) throws ClassNotFoundException {
if (className.startsWith("com.github.stephanenicolas.injectresource")) {
try {
CtClass dummyClass = ClassPool.getDefault().get(className);
if (processor.shouldTransform(dummyClass)) {
log.debug("Intercepting via InjectResource " + className);
processor.applyTransformations(dummyClass);
byte[] bytes = dummyClass.toBytecode();
System.out.println("Size of weaved byte code :" + bytes.length);
FileOutputStream fileOutputStream =
new FileOutputStream("/tmp/" + className + ".class");
fileOutputStream.write(bytes);
fileOutputStream.close();
return bytes;
}
} catch (Exception e) {
throw new RuntimeException("Impossible to transform class " + className, e);
}
}
return super.getByteCode(className);
}
};
}
开发者ID:stephanenicolas,项目名称:injectresource,代码行数:29,代码来源:InjectResourceTestRunner.java
示例7: createRobolectricClassLoader
import org.robolectric.bytecode.Setup; //导入依赖的package包/类
@Override
protected ClassLoader createRobolectricClassLoader(Setup setup, SdkConfig sdkConfig) {
URL[] urls = getJarResolver().getLocalArtifactUrls(sdkConfig.getSdkClasspathDependencies());
return new AsmInstrumentingClassLoader(setup, urls) {
@Override
protected byte[] getByteCode(String className) throws ClassNotFoundException {
if (className.startsWith("com.github.stephanenicolas.injectextra")) {
try {
CtClass dummyClass = ClassPool.getDefault().get(className);
if (processor.shouldTransform(dummyClass)) {
log.debug("Intercepting via InjectExtra " + className);
processor.applyTransformations(dummyClass);
byte[] bytes = dummyClass.toBytecode();
System.out.println("Size of weaved byte code :" + bytes.length);
FileOutputStream fileOutputStream =
new FileOutputStream("/tmp/" + className + ".class");
fileOutputStream.write(bytes);
fileOutputStream.close();
return bytes;
}
} catch (Exception e) {
throw new RuntimeException("Impossible to transform class " + className, e);
}
}
return super.getByteCode(className);
}
};
}
开发者ID:stephanenicolas,项目名称:injectextra,代码行数:29,代码来源:InjectExtraTestRunner.java
示例8: createRobolectricClassLoader
import org.robolectric.bytecode.Setup; //导入依赖的package包/类
@Override
protected ClassLoader createRobolectricClassLoader(Setup setup, SdkConfig sdkConfig) {
URL[] urls = getJarResolver().getLocalArtifactUrls(sdkConfig.getSdkClasspathDependencies());
return new AsmInstrumentingClassLoader(setup, urls) {
@Override
protected byte[] getByteCode(String className) throws ClassNotFoundException {
if (className.startsWith("com.github.stephanenicolas.loglifecycle")) {
try {
CtClass dummyClass = ClassPool.getDefault().get(className);
if (processor.shouldTransform(dummyClass)) {
log.debug("Intercepting via InjectExtra " + className);
processor.applyTransformations(dummyClass);
byte[] bytes = dummyClass.toBytecode();
System.out.println("Size of weaved byte code :" + bytes.length);
FileOutputStream fileOutputStream =
new FileOutputStream("/tmp/" + className + ".class");
fileOutputStream.write(bytes);
fileOutputStream.close();
return bytes;
}
} catch (Exception e) {
throw new RuntimeException("Impossible to transform class " + className, e);
}
}
return super.getByteCode(className);
}
};
}
开发者ID:stephanenicolas,项目名称:loglifecycle,代码行数:29,代码来源:LogLifeCycleTestRunner.java
示例9: createSetup
import org.robolectric.bytecode.Setup; //导入依赖的package包/类
@Override
public Setup createSetup() {
return new Setup() {
@Override
public boolean isFromAndroidSdk(ClassInfo classInfo) {
return super.isFromAndroidSdk(classInfo) || classInfo.getName().startsWith("com.google.ads.")
|| classInfo.getName().startsWith("com.google.analytics.");
}
};
}
开发者ID:KoljaTM,项目名称:Yarrn,代码行数:11,代码来源:MyRobolectricTestRunner.java
示例10: createSetup
import org.robolectric.bytecode.Setup; //导入依赖的package包/类
@Override
public Setup createSetup() {
return new Setup() {
@Override
public boolean isFromAndroidSdk(ClassInfo classInfo) {
return super.isFromAndroidSdk(classInfo) || classInfo.getName().startsWith("com.google.ads.")
|| classInfo.getName().startsWith("com.google.analytics.");
}
};
}
开发者ID:KoljaTM,项目名称:HoebApp,代码行数:11,代码来源:MyRobolectricTestRunner.java
示例11: createSdkEnvironment
import org.robolectric.bytecode.Setup; //导入依赖的package包/类
public SdkEnvironment createSdkEnvironment(SdkConfig sdkConfig) {
Setup setup = createSetup();
ClassLoader robolectricClassLoader = createRobolectricClassLoader(setup, sdkConfig);
return new SdkEnvironment(sdkConfig, robolectricClassLoader);
}
开发者ID:qx,项目名称:FullRobolectricTestSample,代码行数:6,代码来源:RobolectricTestRunner.java
示例12: createSetup
import org.robolectric.bytecode.Setup; //导入依赖的package包/类
public Setup createSetup() {
return new Setup();
}
开发者ID:qx,项目名称:FullRobolectricTestSample,代码行数:4,代码来源:RobolectricTestRunner.java
示例13: createRobolectricClassLoader
import org.robolectric.bytecode.Setup; //导入依赖的package包/类
protected ClassLoader createRobolectricClassLoader(Setup setup, SdkConfig sdkConfig) {
URL[] urls = MAVEN_CENTRAL.getLocalArtifactUrls(this, sdkConfig.getSdkClasspathDependencies());
return new AsmInstrumentingClassLoader(setup, urls);
}
开发者ID:qx,项目名称:FullRobolectricTestSample,代码行数:5,代码来源:RobolectricTestRunner.java
示例14: createSetup
import org.robolectric.bytecode.Setup; //导入依赖的package包/类
/**
* Replaces Robolectric {@link Setup} with {@link MapzenSetup} subclass.
*/
@Override
public Setup createSetup() {
return new MapzenSetup();
}
开发者ID:mapzen,项目名称:open,代码行数:8,代码来源:MapzenTestRunner.java
注:本文中的org.robolectric.bytecode.Setup类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论