fc8eb8270814a903112d7fc5aa9d724bc0b4142d
[dcaegen2/services.git] /
1 /*
2  * ============LICENSE_START=======================================================
3  * ONAP : DATALAKE
4  * ================================================================================
5  * Copyright 2019 China Mobile
6  *=================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *     http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.datalake.feeder.service;
22
23 import org.junit.Test;
24 import org.junit.runner.RunWith;
25 import org.mockito.InjectMocks;
26 import org.mockito.Mock;
27 import org.mockito.junit.MockitoJUnitRunner;
28 import org.onap.datalake.feeder.config.ApplicationConfiguration;
29 import org.springframework.context.ApplicationContext;
30
31 import java.util.List;
32 import java.util.concurrent.ExecutorService;
33
34 import static org.junit.Assert.*;
35 import static org.mockito.Mockito.when;
36
37 @RunWith(MockitoJUnitRunner.class)
38 public class PullServiceTest {
39
40     @InjectMocks
41     private PullService pullService;
42
43     @Mock
44     private ApplicationContext context;
45
46     @Mock
47     private ApplicationConfiguration config;
48
49     @Mock
50     private ExecutorService executorService;
51
52     @Mock
53     private List<Puller> consumers;
54
55     @Test
56     public void isRunning() {
57         assertEquals(pullService.isRunning(), false);
58     }
59
60     @Test(expected = NullPointerException.class)
61     public void start() {
62
63         //when(config.getKafkaConsumerCount()).thenReturn(1);
64
65         pullService.start();
66     }
67
68     @Test
69     public void shutdown() {
70         pullService.shutdown();
71     }
72 }