blob: 7d5689251efcbcb22f24de546c34816731846c41 [file] [log] [blame]
Thomas Vachuskaf9c84362015-04-15 11:20:45 -07001/*
2 * Copyright 2015 Open Networking Laboratory
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.onlab.stc;
17
18import com.google.common.testing.EqualsTester;
19import org.apache.commons.configuration.ConfigurationException;
20import org.junit.Before;
21import org.junit.Test;
22
23import static org.junit.Assert.*;
24
25/**
26 * Test of the test step dependency.
27 */
28public class DependencyTest extends StepTest {
29
30 protected Step step1, step2;
31
32 @Before
33 public void setUp() throws ConfigurationException {
34 super.setUp();
35 step1 = new Step("step1", CMD, null);
36 step2 = new Step("step2", CMD, null);
37 }
38
39 @Test
40 public void hard() {
41 Dependency hard = new Dependency(step1, step2, false);
42 assertSame("incorrect src", step1, hard.src());
43 assertSame("incorrect dst", step2, hard.dst());
44 assertFalse("incorrect isSoft", hard.isSoft());
45 }
46
47 @Test
48 public void soft() {
49 Dependency soft = new Dependency(step2, step1, true);
50 assertSame("incorrect src", step2, soft.src());
51 assertSame("incorrect dst", step1, soft.dst());
52 assertTrue("incorrect isSoft", soft.isSoft());
53 }
54
55 @Test
56 public void equality() {
57 Dependency d1 = new Dependency(step1, step2, false);
58 Dependency d2 = new Dependency(step1, step2, false);
59 Dependency d3 = new Dependency(step1, step2, true);
60 Dependency d4 = new Dependency(step2, step1, true);
61 new EqualsTester()
62 .addEqualityGroup(d1, d2)
63 .addEqualityGroup(d3)
64 .addEqualityGroup(d4)
65 .testEquals();
66 }
67
68}