|
1 |
| package com.agical.rmock.extension.junit; |
|
2 |
| |
|
3 |
| import com.agical.rmock.core.configuration.RMockServiceFactory; |
|
4 |
| |
|
5 |
| public abstract class RMockServiceFactoryTestCase extends RMockTestCase { |
|
6 |
| |
|
7 |
| private RMockServiceFactory rmockServiceFactory; |
|
8 |
| |
|
9 |
| protected abstract Class getExpectedServiceImplementationClass(); |
|
10 |
| protected abstract Class getExpectedServiceClass(); |
|
11 |
| protected abstract RMockServiceFactory getRMockServiceFactory(); |
|
12 |
| |
|
13 |
9
| protected void setUp() throws Exception {
|
|
14 |
9
| super.setUp();
|
|
15 |
9
| rmockServiceFactory = getRMockServiceFactory();
|
|
16 |
| } |
|
17 |
| |
|
18 |
3
| public void testCreate() throws Exception {
|
|
19 |
3
| startVerification();
|
|
20 |
3
| Object object = rmockServiceFactory.createService();
|
|
21 |
3
| assertThat( object, is.NOT_NULL );
|
|
22 |
3
| assertThat( object, is.instanceOf(rmockServiceFactory.getServiceType()) );
|
|
23 |
| } |
|
24 |
| |
|
25 |
3
| public void testCanCreateService() throws Exception {
|
|
26 |
3
| startVerification();
|
|
27 |
3
| boolean b = rmockServiceFactory.canCreateService();
|
|
28 |
3
| assertThat( b, is.TRUE );
|
|
29 |
| } |
|
30 |
| |
|
31 |
3
| public void testGetServiceType() throws Exception {
|
|
32 |
3
| startVerification();
|
|
33 |
3
| Class clazz = rmockServiceFactory.getServiceType();
|
|
34 |
3
| assertThat( clazz, is.NOT_NULL.and( is.eq(getExpectedServiceClass() ) ) );
|
|
35 |
| } |
|
36 |
| } |