Thomas Vachuska | f9c8436 | 2015-04-15 11:20:45 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Laboratory |
Thomas Vachuska | f9c8436 | 2015-04-15 11:20:45 -0700 | [diff] [blame] | 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 | 664f29e | 2015-12-08 12:58:16 -0800 | [diff] [blame] | 31 | Group group = new Group(NAME, CMD, ENV, CWD, parent, 1); |
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()); |
Thomas Vachuska | 664f29e | 2015-12-08 12:58:16 -0800 | [diff] [blame] | 37 | assertEquals("incorrect delay", 1, group.delay()); |
Thomas Vachuska | f9c8436 | 2015-04-15 11:20:45 -0700 | [diff] [blame] | 38 | |
Thomas Vachuska | 664f29e | 2015-12-08 12:58:16 -0800 | [diff] [blame] | 39 | Step step = new Step("step", null, null, null, group, 0); |
Thomas Vachuska | f9c8436 | 2015-04-15 11:20:45 -0700 | [diff] [blame] | 40 | group.addChild(step); |
| 41 | assertSame("incorrect child", step, group.children().iterator().next()); |
| 42 | } |
| 43 | |
| 44 | @Test |
| 45 | public void equality() { |
Thomas Vachuska | 664f29e | 2015-12-08 12:58:16 -0800 | [diff] [blame] | 46 | Group g1 = new Group(NAME, CMD, null, null, parent, 0); |
| 47 | Group g2 = new Group(NAME, CMD, ENV, CWD, null, 0); |
| 48 | Group g3 = new Group("foo", null, null, null, parent, 0); |
Thomas Vachuska | f9c8436 | 2015-04-15 11:20:45 -0700 | [diff] [blame] | 49 | new EqualsTester() |
| 50 | .addEqualityGroup(g1, g2) |
| 51 | .addEqualityGroup(g3) |
| 52 | .testEquals(); |
| 53 | } |
| 54 | |
| 55 | } |