2 * In Samsung Ukraine R&D Center (SRK under a contract between)
3 * LLC "Samsung Electronics Co", Ltd (Seoul, Republic of Korea)
4 * Copyright (C) 2018 Samsung Electronics Co., Ltd. All rights reserved.
6 package com.samsung.samserver.service.impl;
8 import com.samsung.samserver.domain.*;
9 import com.samsung.samserver.service.ReportTypeService;
10 import com.samsung.samserver.service.RuleService;
11 import com.samsung.samserver.service.UpdatesService;
12 import org.junit.Before;
13 import org.junit.Test;
14 import org.mockito.InjectMocks;
15 import org.mockito.Mock;
16 import org.mockito.MockitoAnnotations;
17 import org.slf4j.Logger;
19 import static org.mockito.Mockito.*;
22 * Test class for the AnalyzeServiceImpl.
24 * @see AnalyzeServiceImpl
26 public class AnalyzeServiceImplTest {
30 ReportTypeService reportTypeService;
32 RuleService ruleService;
34 UpdatesService updatesService;
36 AnalyzeServiceImpl analyzeServiceImpl;
40 MockitoAnnotations.initMocks(this);
44 public void testAnalyze() throws Exception {
45 when(reportTypeService.findOneWithRules(anyLong())).thenReturn(new ReportType("name", "descr"));
46 when(ruleService.findOneWithActions(anyLong())).thenReturn(new Rule());
47 when(updatesService.save(any())).thenReturn(new Updates("uuid", "type", "uri", null, "descr", "data", new Device()));
48 when(updatesService.getUpdateUID(any(), any())).thenReturn("getUpdateUIDResponse");
49 when(updatesService.find(anyString(), any())).thenReturn(null);
51 analyzeServiceImpl.analyze(new Report("data", new ReportType("name", "descr"), new Device()));