My question is about testing a class that implements many interfaces. For example, I have this class:

```
public class ServiceControllerImpl extends ServiceController implements IDataChanged, IEventChanged {

}

```

Now there are two ways for testing. The first is testing directly on the concrete class. That means the object type is the concrete class rather than the interface.

```
public class ServiceControllerImplTest {
    ServiceControllerImpl instance;
    @Before
     public void setUp() {
         instance = new ServiceControllerImpl();
         // you can bring this instance anywhere
     }
}

```

The second way is testing on the interface only. We must typecast this object to all interfaces it implements.

```
public class ServiceControllerImplTest {
    ServiceController instance;       // use interface here 
    IDataChanged dataChangeListener;

    @Before
     public void setUp() {
         instance = new ServiceControllerImpl();
         dataChangeListener = (IDataChanged) instance;
         // instance and dataChangeListener "look like" two different object.
     }
}

```

I prefer the second solution because maybe in future we can change the interface it implements to other objects, so using the concrete class might lead to failing tests in the future. I don't know the best practice for this problem. 

Thanks :)