Thomas Vachuska | f9c8436 | 2015-04-15 11:20:45 -0700 | [diff] [blame] | 1 | /* |
| 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 | */ |
| 16 | package org.onlab.stc; |
| 17 | |
| 18 | import com.google.common.testing.EqualsTester; |
| 19 | import org.junit.Test; |
| 20 | |
| 21 | import static org.junit.Assert.assertEquals; |
| 22 | import static org.junit.Assert.assertSame; |
| 23 | |
| 24 | /** |
| 25 | * Test of the test scenario entity. |
| 26 | */ |
| 27 | public class GroupTest extends StepTest { |
| 28 | |
| 29 | @Test |
| 30 | public void basics() { |
Thomas Vachuska | 4bfccd54 | 2015-05-30 00:35:25 -0700 | [diff] [blame] | 31 | Group group = new Group(NAME, CMD, ENV, CWD, parent); |
Thomas Vachuska | f9c8436 | 2015-04-15 11:20:45 -0700 | [diff] [blame] | 32 | assertEquals("incorrect name", NAME, group.name()); |
| 33 | assertEquals("incorrect command", CMD, group.command()); |
Thomas Vachuska | 4bfccd54 | 2015-05-30 00:35:25 -0700 | [diff] [blame] | 34 | assertEquals("incorrect env", ENV, group.env()); |
| 35 | assertEquals("incorrect cwd", CWD, group.cwd()); |
Thomas Vachuska | f9c8436 | 2015-04-15 11:20:45 -0700 | [diff] [blame] | 36 | assertSame("incorrect group", parent, group.group()); |
| 37 | |
Thomas Vachuska | 4bfccd54 | 2015-05-30 00:35:25 -0700 | [diff] [blame] | 38 | Step step = new Step("step", null, null, null, group); |
Thomas Vachuska | f9c8436 | 2015-04-15 11:20:45 -0700 | [diff] [blame] | 39 | group.addChild(step); |
| 40 | assertSame("incorrect child", step, group.children().iterator().next()); |
| 41 | } |
| 42 | |
| 43 | @Test |
| 44 | public void equality() { |
Thomas Vachuska | 4bfccd54 | 2015-05-30 00:35:25 -0700 | [diff] [blame] | 45 | 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 Vachuska | f9c8436 | 2015-04-15 11:20:45 -0700 | [diff] [blame] | 48 | new EqualsTester() |
| 49 | .addEqualityGroup(g1, g2) |
| 50 | .addEqualityGroup(g3) |
| 51 | .testEquals(); |
| 52 | } |
| 53 | |
| 54 | } |