Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

it can not support shadow Thread.class ? #4662

Closed
yuhui2016github opened this issue Feb 21, 2019 · 1 comment
Closed

it can not support shadow Thread.class ? #4662

yuhui2016github opened this issue Feb 21, 2019 · 1 comment

Comments

@yuhui2016github
Copy link

yuhui2016github commented Feb 21, 2019

Description

does not support shadow Thread.class

Steps to Reproduce

@Implements(Thread.class)
public class ShadowThread extends Thread {

    @RealObject
    private Thread thread;

    @Implementation
    public synchronized void start() {
        System.out.println("========Thread start ======");
        thread.run();
    }
}

@Config(manifest = "src/main/AndroidManifest.xml", shadows = {MyShadowHandler.class, ShadowThread.class})
public Class .... {

....
@Test
    public void onNetworkAvailable() throws Exception {
        Thread thread = new Thread();
        thread.start();
}
}

it does not run into ShadowThread.start() method, I have another shadowHandler class which can work,

Robolectric & Android Version

org.robolectric:robolectric:3.3.2

Link to a public git repo demonstrating the problem:

@xian
Copy link
Member

xian commented Feb 21, 2019

Robolectric doesn't support shadows for classes under the java. package unfortunately.

@xian xian closed this as completed Feb 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants