blob: 6b3ee790e8b264d98e2280899fbac8948dabee0d [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.assertEquals;
24import static org.junit.Assert.assertSame;
25
26/**
27 * Test of the test step entity.
28 */
29public class StepTest {
30
31 protected static final String NAME = "step";
32 protected static final String CMD = "command";
33 protected Group parent;
34
35 @Before
36 public void setUp() throws ConfigurationException {
37 parent = new Group("parent", null, null);
38 }
39
40 @Test
41 public void basics() {
42 Step step = new Step(NAME, CMD, parent);
43 assertEquals("incorrect name", NAME, step.name());
44 assertEquals("incorrect command", CMD, step.command());
45 assertSame("incorrect group", parent, step.group());
46 }
47
48 @Test
49 public void equality() {
50 Step s1 = new Step(NAME, CMD, parent);
51 Step s2 = new Step(NAME, CMD, null);
52 Step s3 = new Step("foo", null, parent);
53 new EqualsTester()
54 .addEqualityGroup(s1, s2)
55 .addEqualityGroup(s3)
56 .testEquals();
57 }
58}