Im testing a Task class that runs until an **AtomicBoolean** value changes. I'm using PowerMockito because get() method of AtomicBoolean instance is final.  

**MyTaskTest** looks like this:

```
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;

import java.util.concurrent.atomic.AtomicBoolean;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;

@RunWith(PowerMockRunner.class)
@PrepareForTest(AtomicBoolean.class)
public class MyTaskTest {

    private AtomicBoolean stopReceiving;
    private MyTask task;

    @Before
    public void setUp() {
        stopReceiving = PowerMockito.mock(AtomicBoolean.class);
        task = new MyTask(stopReceiving);
    }

    @Test
    public void test_run_when_StopReceivingIsFalseFromTheBeginning_should_invokeGetOnlyOnce() {
        // given
        PowerMockito.when(stopReceiving.get()).thenReturn(false);
        // when
        task.run();
        // then
        verify(stopReceiving, times(1)).get();
    }

}

```

And **MyTask** class looks like this:

```
import java.util.concurrent.atomic.AtomicBoolean;

public class MyTask implements Runnable {

    private final AtomicBoolean stopReceiving;

    MyTask(AtomicBoolean stopReceiving) {
        if (stopReceiving == null) {
            throw new NullPointerException("stopReceiving is null. This argument should not be null");
        }

        this.stopReceiving = stopReceiving;
    }

    @Override
    public void run() {
        while (stopReceiving.get() == true) {
            System.out.println("I should not get to here!");
        }
    }
}

```

The problem here is that check `verify(stopReceiving, times(1)).get();` fails with: 

> 
> Wanted but not invoked
>  java.util.concurrent.atomic.AtomicBoolean.get(); Actually, there were
>  zero interactions with this mock.
> 
> 
> 

which does not make sense to me because it is clearly called in `run()` method. I even debugged it and it passed through `run` method, but somehow did not increment invoke counter on it. What am I doing wrong here?  

P.S. I'm using PowerMockito version 1.6.2

**What I tried**

* Changing verify call to be called without `times(1)`. Didn't help
* Upgrading powermockito version to 1.6.3. Didn't help
* Adding **MyTask** into **MyTaskTest** as inner class, which somehow worked, meaning that verify call passed, but I wanted to have **MyTask** in the other file as separate class, which still does not work.