blob: 9b612c8533a344dd25ab3810b01bbd8f7a02315f [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.junit.Test;
20
21import static org.junit.Assert.assertEquals;
22import static org.junit.Assert.assertSame;
23
24/**
25 * Test of the test scenario entity.
26 */
27public class GroupTest extends StepTest {
28
29 @Test
30 public void basics() {
Thomas Vachuska4bfccd542015-05-30 00:35:25 -070031 Group group = new Group(NAME, CMD, ENV, CWD, parent);
Thomas Vachuskaf9c84362015-04-15 11:20:45 -070032 assertEquals("incorrect name", NAME, group.name());
33 assertEquals("incorrect command", CMD, group.command());
Thomas Vachuska4bfccd542015-05-30 00:35:25 -070034 assertEquals("incorrect env", ENV, group.env());
35 assertEquals("incorrect cwd", CWD, group.cwd());
Thomas Vachuskaf9c84362015-04-15 11:20:45 -070036 assertSame("incorrect group", parent, group.group());
37
Thomas Vachuska4bfccd542015-05-30 00:35:25 -070038 Step step = new Step("step", null, null, null, group);
Thomas Vachuskaf9c84362015-04-15 11:20:45 -070039 group.addChild(step);
40 assertSame("incorrect child", step, group.children().iterator().next());
41 }
42
43 @Test
44 public void equality() {
Thomas Vachuska4bfccd542015-05-30 00:35:25 -070045 Group g1 = new Group(NAME, CMD, null, null, parent);
46 Group g2 = new Group(NAME, CMD, ENV, CWD, null);
47 Group g3 = new Group("foo", null, null, null, parent);
Thomas Vachuskaf9c84362015-04-15 11:20:45 -070048 new EqualsTester()
49 .addEqualityGroup(g1, g2)
50 .addEqualityGroup(g3)
51 .testEquals();
52 }
53
54}