blob: 46de87c71d23b21df873be1df6814ed256db6cc9 [file] [log] [blame]
Sean Condon0e89bda2017-03-21 14:23:19 +00001/*
2 * Copyright 2017-present Open Networking Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.incubator.net.l2monitoring.soam.loss;
17
18import static org.junit.Assert.assertEquals;
19import static org.junit.Assert.assertTrue;
20
21import java.time.Duration;
22import java.time.Instant;
23
24import org.junit.Before;
25import org.junit.Test;
26import org.onosproject.incubator.net.l2monitoring.soam.SoamId;
27import org.onosproject.incubator.net.l2monitoring.soam.loss.LossMeasurementStatHistory.LmStatHistoryBuilder;
28
29public class LossMeasurementStatHistoryTest {
30 LossMeasurementStatHistory lmsh1;
31
32 @Before
33 public void setUp() {
34 LmStatHistoryBuilder builder = DefaultLmStatHistory.builder(
35 Duration.ofMinutes(11), true, SoamId.valueOf(6),
36 Instant.ofEpochSecond(123456789L));
37
38 lmsh1 = builder.build();
39 }
40
41 @Test
42 public void testHistoryStatsId() {
43 assertEquals(6, lmsh1.historyStatsId().id().intValue());
44 }
45
46 @Test
47 public void testEndTime() {
48 assertEquals(123456789L, lmsh1.endTime().getEpochSecond());
49 }
50
51 @Test
52 public void testElapsedTime() {
53 assertEquals(11, lmsh1.elapsedTime().toMinutes());
54 }
55
56 @Test
57 public void testSuspectStatus() {
58 assertTrue(lmsh1.suspectStatus());
59 }
60
61}