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() { |
| 31 | Group group = new Group(NAME, CMD, parent); |
| 32 | assertEquals("incorrect name", NAME, group.name()); |
| 33 | assertEquals("incorrect command", CMD, group.command()); |
| 34 | assertSame("incorrect group", parent, group.group()); |
| 35 | |
| 36 | Step step = new Step("step", null, group); |
| 37 | group.addChild(step); |
| 38 | assertSame("incorrect child", step, group.children().iterator().next()); |
| 39 | } |
| 40 | |
| 41 | @Test |
| 42 | public void equality() { |
| 43 | Group g1 = new Group(NAME, CMD, parent); |
| 44 | Group g2 = new Group(NAME, CMD, null); |
| 45 | Group g3 = new Group("foo", null, parent); |
| 46 | new EqualsTester() |
| 47 | .addEqualityGroup(g1, g2) |
| 48 | .addEqualityGroup(g3) |
| 49 | .testEquals(); |
| 50 | } |
| 51 | |
| 52 | } |