2 * Copyright 2017 ZTE Corporation.
\r
4 * Licensed under the Apache License, Version 2.0 (the "License");
\r
5 * you may not use this file except in compliance with the License.
\r
6 * You may obtain a copy of the License at
\r
8 * http://www.apache.org/licenses/LICENSE-2.0
\r
10 * Unless required by applicable law or agreed to in writing, software
\r
11 * distributed under the License is distributed on an "AS IS" BASIS,
\r
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
13 * See the License for the specific language governing permissions and
\r
14 * limitations under the License.
\r
17 package org.onap.holmes.common.utils;
\r
19 import org.junit.Test;
\r
20 import org.powermock.api.easymock.PowerMock;
\r
22 import java.sql.ResultSet;
\r
24 import static org.easymock.EasyMock.expect;
\r
26 public class AlarmInfoMapperTest {
\r
29 public void map() throws Exception {
\r
30 AlarmInfoMapper mapper = new AlarmInfoMapper();
\r
31 ResultSet resultSet = PowerMock.createMock(ResultSet.class);
\r
32 expect(resultSet.getString("eventid")).andReturn("");
\r
33 expect(resultSet.getString("eventname")).andReturn("");
\r
34 expect(resultSet.getString("sourceid")).andReturn("");
\r
35 expect(resultSet.getString("sourcename")).andReturn("");
\r
36 expect(resultSet.getLong("startepochmicrosec")).andReturn(0L);
\r
37 expect(resultSet.getLong("lastepochmicrosec")).andReturn(0L);
\r
38 expect(resultSet.getInt("alarmiscleared")).andReturn(0);
\r
39 expect(resultSet.getInt("rootflag")).andReturn(0);
\r
40 PowerMock.replay(resultSet);
\r
41 mapper.map(0, resultSet, null);
\r
42 PowerMock.verify(resultSet);
\r