blob: 1b68b6e88d897a2d9929f1087ba823d21ea953d8 [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.LossAvailabilityStatHistory.LaStatHistoryBuilder;
28
29public class LossAvailabilityStatHistoryTest {
30 LossAvailabilityStatHistory lash1;
31
32 @Before
33 public void setUp() {
34 LaStatHistoryBuilder builder = DefaultLaStatHistory.builder(
35 Duration.ofMinutes(12), true, SoamId.valueOf(5),
36 Instant.ofEpochSecond(123456789L));
37
38 lash1 = builder.build();
39 }
40
41 @Test
42 public void testHistoryStatsId() {
43 assertEquals(5, lash1.historyStatsId().id().intValue());
44 }
45
46 @Test
47 public void testEndTime() {
48 assertEquals(123456789L, lash1.endTime().getEpochSecond());
49 }
50
51 @Test
52 public void testElapsedTime() {
53 assertEquals(12, lash1.elapsedTime().toMinutes());
54 }
55
56 @Test
57 public void testSuspectStatus() {
58 assertTrue(lash1.suspectStatus());
59 }
60
61}