Unit test refactoring
- removed tests no longer useful now that all Intent objects are unique
- fixed intent object equality tests
- enabled several immutable base class tests
- renamed several Test....java classes to ...Test.Java to
match project best practices
Change-Id: Ic829d6d39556d2f63323f5e82f3807dba86c62ec
diff --git a/core/api/src/test/java/org/onlab/onos/net/intent/HostToHostIntentTest.java b/core/api/src/test/java/org/onlab/onos/net/intent/HostToHostIntentTest.java
index a6ce3dd..d1405b9 100644
--- a/core/api/src/test/java/org/onlab/onos/net/intent/HostToHostIntentTest.java
+++ b/core/api/src/test/java/org/onlab/onos/net/intent/HostToHostIntentTest.java
@@ -15,13 +15,17 @@
*/
package org.onlab.onos.net.intent;
-import org.junit.Ignore;
import org.junit.Test;
+import org.onlab.onos.TestApplicationId;
+import org.onlab.onos.core.ApplicationId;
import org.onlab.onos.net.HostId;
import org.onlab.onos.net.flow.TrafficSelector;
import com.google.common.testing.EqualsTester;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.is;
import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
import static org.onlab.onos.net.NetTestTools.APP_ID;
import static org.onlab.onos.net.NetTestTools.hid;
@@ -36,6 +40,28 @@
private final HostId id2 = hid("12:34:56:78:92:ab/1");
private final HostId id3 = hid("12:34:56:78:93:ab/1");
+ private static final ApplicationId APPID = new TestApplicationId("foo");
+
+ private HostToHostIntent makeHostToHost(HostId one, HostId two) {
+ return new HostToHostIntent(APPID, one, two, selector, treatment);
+ }
+
+ /**
+ * Tests the equals() method where two HostToHostIntents have references
+ * to the same hosts. These should compare equal.
+ */
+ @Test
+ public void testSameEquals() {
+
+ HostId one = hid("00:00:00:00:00:01/-1");
+ HostId two = hid("00:00:00:00:00:02/-1");
+ HostToHostIntent i1 = makeHostToHost(one, two);
+ HostToHostIntent i2 = makeHostToHost(one, two);
+
+ assertThat(i1.one(), is(equalTo(i2.one())));
+ assertThat(i1.two(), is(equalTo(i2.two())));
+ }
+
/**
* Checks that the HostToHostIntent class is immutable.
*/
@@ -47,18 +73,14 @@
/**
* Tests equals(), hashCode() and toString() methods.
*/
- @Test @Ignore("Equality is based on ids, which will be different")
+ @Test
public void testEquals() {
final HostToHostIntent intent1 = new HostToHostIntent(APP_ID,
id1,
id2,
selector,
treatment);
- final HostToHostIntent sameAsIntent1 = new HostToHostIntent(APP_ID,
- id1,
- id2,
- selector,
- treatment);
+
final HostToHostIntent intent2 = new HostToHostIntent(APP_ID,
id2,
id3,
@@ -66,7 +88,7 @@
treatment);
new EqualsTester()
- .addEqualityGroup(intent1, sameAsIntent1)
+ .addEqualityGroup(intent1)
.addEqualityGroup(intent2)
.testEquals();
}
diff --git a/core/api/src/test/java/org/onlab/onos/net/intent/IntentTest.java b/core/api/src/test/java/org/onlab/onos/net/intent/IntentTest.java
index ab805bf..2f675b7 100644
--- a/core/api/src/test/java/org/onlab/onos/net/intent/IntentTest.java
+++ b/core/api/src/test/java/org/onlab/onos/net/intent/IntentTest.java
@@ -15,15 +15,10 @@
*/
package org.onlab.onos.net.intent;
-import org.junit.Ignore;
-import org.junit.Test;
-
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
-import static org.junit.Assert.*;
-
/**
* Base facilities to test various intent tests.
*/
@@ -39,24 +34,6 @@
return new HashSet<>(Arrays.asList(items));
}
- @Test @Ignore("Equality is based on ids, which will be different")
- public void equalsAndHashCode() {
- Intent one = createOne();
- Intent like = createOne();
- Intent another = createAnother();
-
- assertTrue("should be equal", one.equals(like));
- assertEquals("incorrect hashCode", one.hashCode(), like.hashCode());
- assertFalse("should not be equal", one.equals(another));
- }
-
- //@Test FIXME
- public void testToString() {
- Intent one = createOne();
- Intent like = createOne();
- assertEquals("incorrect toString", one.toString(), like.toString());
- }
-
/**
* Creates a new intent, but always a like intent, i.e. all instances will
* be equal, but should not be the same.
diff --git a/core/api/src/test/java/org/onlab/onos/net/intent/LinkCollectionIntentTest.java b/core/api/src/test/java/org/onlab/onos/net/intent/LinkCollectionIntentTest.java
index 4b47734..f785196 100644
--- a/core/api/src/test/java/org/onlab/onos/net/intent/LinkCollectionIntentTest.java
+++ b/core/api/src/test/java/org/onlab/onos/net/intent/LinkCollectionIntentTest.java
@@ -20,7 +20,6 @@
import java.util.List;
import java.util.Set;
-import org.junit.Ignore;
import org.junit.Test;
import org.onlab.onos.net.ConnectPoint;
import org.onlab.onos.net.Link;
@@ -61,7 +60,7 @@
/**
* Tests equals(), hashCode() and toString() methods.
*/
- @Test @Ignore("Equality is based on ids, which will be different")
+ @Test
public void testEquals() {
final HashSet<Link> links1 = new HashSet<>();
@@ -72,12 +71,6 @@
treatment,
links1,
egress);
- final LinkCollectionIntent sameAsCollectionIntent1 =
- new LinkCollectionIntent(APP_ID,
- selector,
- treatment,
- links1,
- egress);
final HashSet<Link> links2 = new HashSet<>();
links2.add(link("src", 1, "dst", 3));
@@ -89,7 +82,7 @@
egress);
new EqualsTester()
- .addEqualityGroup(collectionIntent1, sameAsCollectionIntent1)
+ .addEqualityGroup(collectionIntent1)
.addEqualityGroup(collectionIntent2)
.testEquals();
}
diff --git a/core/api/src/test/java/org/onlab/onos/net/intent/MultiPointToSinglePointIntentTest.java b/core/api/src/test/java/org/onlab/onos/net/intent/MultiPointToSinglePointIntentTest.java
index 4ab3699..fd751ec 100644
--- a/core/api/src/test/java/org/onlab/onos/net/intent/MultiPointToSinglePointIntentTest.java
+++ b/core/api/src/test/java/org/onlab/onos/net/intent/MultiPointToSinglePointIntentTest.java
@@ -18,12 +18,21 @@
import org.junit.Test;
import static org.junit.Assert.assertEquals;
+import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
/**
* Suite of tests of the multi-to-single point intent descriptor.
*/
public class MultiPointToSinglePointIntentTest extends ConnectivityIntentTest {
+ /**
+ * Checks that the MultiPointToSinglePointIntent class is immutable.
+ */
+ @Test
+ public void checkImmutability() {
+ assertThatClassIsImmutable(MultiPointToSinglePointIntent.class);
+ }
+
@Test
public void basics() {
MultiPointToSinglePointIntent intent = createOne();
diff --git a/core/api/src/test/java/org/onlab/onos/net/intent/PointToPointIntentTest.java b/core/api/src/test/java/org/onlab/onos/net/intent/PointToPointIntentTest.java
index 67c728e..3fbd2b3 100644
--- a/core/api/src/test/java/org/onlab/onos/net/intent/PointToPointIntentTest.java
+++ b/core/api/src/test/java/org/onlab/onos/net/intent/PointToPointIntentTest.java
@@ -18,12 +18,21 @@
import org.junit.Test;
import static org.junit.Assert.assertEquals;
+import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutableBaseClass;
/**
* Suite of tests of the point-to-point intent descriptor.
*/
public class PointToPointIntentTest extends ConnectivityIntentTest {
+ /**
+ * Checks that the MultiPointToSinglePointIntent class is immutable.
+ */
+ @Test
+ public void checkImmutability() {
+ assertThatClassIsImmutableBaseClass(PointToPointIntent.class);
+ }
+
@Test
public void basics() {
PointToPointIntent intent = createOne();
diff --git a/core/net/src/test/java/org/onlab/onos/net/intent/TestHostToHostIntent.java b/core/net/src/test/java/org/onlab/onos/net/intent/TestHostToHostIntent.java
deleted file mode 100644
index 11311a7f..0000000
--- a/core/net/src/test/java/org/onlab/onos/net/intent/TestHostToHostIntent.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright 2014 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onlab.onos.net.intent;
-
-import org.junit.Ignore;
-import org.junit.Test;
-import org.onlab.onos.core.ApplicationId;
-import org.onlab.onos.TestApplicationId;
-import org.onlab.onos.net.HostId;
-import org.onlab.onos.net.flow.TrafficSelector;
-import org.onlab.onos.net.flow.TrafficTreatment;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.equalTo;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.not;
-import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
-import static org.onlab.onos.net.NetTestTools.hid;
-
-/**
- * Unit tests for the HostToHostIntent class.
- */
-public class TestHostToHostIntent {
-
- private static final ApplicationId APPID = new TestApplicationId("foo");
-
- private TrafficSelector selector = new IntentTestsMocks.MockSelector();
- private TrafficTreatment treatment = new IntentTestsMocks.MockTreatment();
-
- private HostToHostIntent makeHostToHost(HostId one, HostId two) {
- return new HostToHostIntent(APPID, one, two, selector, treatment);
- }
-
- /**
- * Tests the equals() method where two HostToHostIntents have references
- * to the same hosts. These should compare equal.
- */
- @Test @Ignore("Needs to be merged with other API test")
- public void testSameEquals() {
-
- HostId one = hid("00:00:00:00:00:01/-1");
- HostId two = hid("00:00:00:00:00:02/-1");
- HostToHostIntent i1 = makeHostToHost(one, two);
- HostToHostIntent i2 = makeHostToHost(one, two);
-
- assertThat(i1, is(equalTo(i2)));
- }
-
- /**
- * Tests the equals() method where two HostToHostIntents have references
- * to different Hosts. These should compare not equal.
- */
- @Test @Ignore("Needs to be merged with other API test")
- public void testSameEquals2() {
- HostId one = hid("00:00:00:00:00:01/-1");
- HostId two = hid("00:00:00:00:00:02/-1");
- HostToHostIntent i1 = makeHostToHost(one, two);
- HostToHostIntent i2 = makeHostToHost(two, one);
-
- assertThat(i1, is(equalTo(i2)));
- }
-
- /**
- * Tests that the hashCode() values for two equivalent HostToHostIntent
- * objects are the same.
- */
- @Test @Ignore("Needs to be merged with other API test")
- public void testHashCodeEquals() {
- HostId one = hid("00:00:00:00:00:01/-1");
- HostId two = hid("00:00:00:00:00:02/-1");
- HostToHostIntent i1 = makeHostToHost(one, two);
- HostToHostIntent i2 = makeHostToHost(one, two);
-
- assertThat(i1.hashCode(), is(equalTo(i2.hashCode())));
- }
-
- /**
- * Tests that the hashCode() values for two distinct LinkCollectionIntent
- * objects are different.
- */
- @Test @Ignore("Needs to be merged with other API test")
- public void testHashCodeEquals2() {
- HostId one = hid("00:00:00:00:00:01/-1");
- HostId two = hid("00:00:00:00:00:02/-1");
- HostToHostIntent i1 = makeHostToHost(one, two);
- HostToHostIntent i2 = makeHostToHost(two, one);
-
- assertThat(i1.hashCode(), is(equalTo(i2.hashCode())));
- }
-
- /**
- * Tests that the hashCode() values for two distinct LinkCollectionIntent
- * objects are different.
- */
- @Test @Ignore("Needs to be merged with other API test")
- public void testHashCodeDifferent() {
- HostId one = hid("00:00:00:00:00:01/-1");
- HostId two = hid("00:00:00:00:00:02/-1");
- HostId three = hid("00:00:00:00:00:32/-1");
- HostToHostIntent i1 = makeHostToHost(one, two);
- HostToHostIntent i2 = makeHostToHost(one, three);
-
- assertThat(i1.hashCode(), is(not(equalTo(i2.hashCode()))));
- }
-
- /**
- * Checks that the HostToHostIntent class is immutable.
- */
- @Test
- public void checkImmutability() {
- assertThatClassIsImmutable(HostToHostIntent.class);
- }
-}
diff --git a/core/net/src/test/java/org/onlab/onos/net/intent/TestLinkCollectionIntent.java b/core/net/src/test/java/org/onlab/onos/net/intent/TestLinkCollectionIntent.java
deleted file mode 100644
index d1a8a8d..0000000
--- a/core/net/src/test/java/org/onlab/onos/net/intent/TestLinkCollectionIntent.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Copyright 2014 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onlab.onos.net.intent;
-
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.equalTo;
-import static org.hamcrest.Matchers.is;
-import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
-import static org.onlab.onos.net.NetTestTools.link;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.onlab.onos.core.ApplicationId;
-import org.onlab.onos.TestApplicationId;
-import org.onlab.onos.net.ConnectPoint;
-import org.onlab.onos.net.DeviceId;
-import org.onlab.onos.net.Link;
-import org.onlab.onos.net.PortNumber;
-import org.onlab.onos.net.flow.TrafficSelector;
-import org.onlab.onos.net.flow.TrafficTreatment;
-
-/**
- * Unit tests for the LinkCollectionIntent class.
- */
-public class TestLinkCollectionIntent {
-
- private static final ApplicationId APPID = new TestApplicationId("foo");
-
- private Link link1 = link("dev1", 1, "dev2", 2);
- private Link link2 = link("dev1", 1, "dev3", 2);
- private Link link3 = link("dev2", 1, "dev3", 2);
-
- private Set<Link> links1;
- private Set<Link> links2;
-
- private ConnectPoint egress1 = new ConnectPoint(DeviceId.deviceId("dev1"),
- PortNumber.portNumber(3));
- private ConnectPoint egress2 = new ConnectPoint(DeviceId.deviceId("dev2"),
- PortNumber.portNumber(3));
-
- private TrafficSelector selector = new IntentTestsMocks.MockSelector();
- private TrafficTreatment treatment = new IntentTestsMocks.MockTreatment();
-
- private LinkCollectionIntent makeLinkCollection(Set<Link> links,
- ConnectPoint egress) {
- return new LinkCollectionIntent(APPID, selector, treatment, links, egress);
- }
-
- @Before
- public void setup() {
- links1 = new HashSet<>();
- links2 = new HashSet<>();
- }
-
- /**
- * Tests the equals() method where two LinkCollectionIntents have references
- * to the same Links in different orders. These should compare equal.
- */
- @Test @Ignore("Needs to be merged with other API test")
- public void testSameEquals() {
- links1.add(link1);
- links1.add(link2);
- links1.add(link3);
-
- links2.add(link3);
- links2.add(link2);
- links2.add(link1);
-
- LinkCollectionIntent i1 = makeLinkCollection(links1, egress1);
- LinkCollectionIntent i2 = makeLinkCollection(links2, egress1);
-
- assertThat(i1, is(equalTo(i2)));
- }
-
- /**
- * Tests the equals() method where two LinkCollectionIntents have references
- * to different Links. These should compare not equal.
- */
- @Test @Ignore("Needs to be merged with other API test")
- public void testLinksDifferentEquals() {
- links1.add(link1);
- links1.add(link2);
-
- links2.add(link3);
- links2.add(link1);
-
- LinkCollectionIntent i1 = makeLinkCollection(links1, egress1);
- LinkCollectionIntent i2 = makeLinkCollection(links2, egress1);
-
- assertThat(i1, is(not(equalTo(i2))));
- }
-
- /**
- * Tests the equals() method where two LinkCollectionIntents have references
- * to the same Links but different egress points. These should compare not equal.
- */
- @Test @Ignore("Needs to be merged with other API test")
- public void testEgressDifferentEquals() {
- links1.add(link1);
- links1.add(link2);
- links1.add(link3);
-
- links2.add(link3);
- links2.add(link2);
- links2.add(link1);
-
- LinkCollectionIntent i1 = makeLinkCollection(links1, egress1);
- LinkCollectionIntent i2 = makeLinkCollection(links2, egress2);
-
- assertThat(i1, is(not(equalTo(i2))));
- }
-
- /**
- * Tests that the hashCode() values for two equivalent LinkCollectionIntent
- * objects are the same.
- */
- @Test @Ignore("Needs to be merged with other API test")
- public void testHashCodeEquals() {
- links1.add(link1);
- links1.add(link2);
- links1.add(link3);
-
- links2.add(link3);
- links2.add(link2);
- links2.add(link1);
-
- LinkCollectionIntent i1 = makeLinkCollection(links1, egress1);
- LinkCollectionIntent i2 = makeLinkCollection(links2, egress1);
-
- assertThat(i1.hashCode(), is(equalTo(i2.hashCode())));
- }
-
- /**
- * Tests that the hashCode() values for two distinct LinkCollectionIntent
- * objects are different.
- */
- @Test @Ignore("Needs to be merged with other API test")
- public void testHashCodeDifferent() {
- links1.add(link1);
- links1.add(link2);
-
- links2.add(link1);
- links2.add(link3);
-
- LinkCollectionIntent i1 = makeLinkCollection(links1, egress1);
- LinkCollectionIntent i2 = makeLinkCollection(links2, egress2);
-
- assertThat(i1.hashCode(), is(not(equalTo(i2.hashCode()))));
- }
-
- /**
- * Checks that the HostToHostIntent class is immutable.
- */
- @Test
- public void checkImmutability() {
- assertThatClassIsImmutable(LinkCollectionIntent.class);
- }
-}
diff --git a/core/net/src/test/java/org/onlab/onos/net/intent/TestMultiPointToSinglePointIntent.java b/core/net/src/test/java/org/onlab/onos/net/intent/TestMultiPointToSinglePointIntent.java
deleted file mode 100644
index b0c244b..0000000
--- a/core/net/src/test/java/org/onlab/onos/net/intent/TestMultiPointToSinglePointIntent.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Copyright 2014 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onlab.onos.net.intent;
-
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.onlab.onos.core.ApplicationId;
-import org.onlab.onos.TestApplicationId;
-import org.onlab.onos.net.ConnectPoint;
-import org.onlab.onos.net.flow.TrafficSelector;
-import org.onlab.onos.net.flow.TrafficTreatment;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.equalTo;
-import static org.hamcrest.Matchers.is;
-import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
-import static org.onlab.onos.net.NetTestTools.connectPoint;
-
-/**
- * Unit tests for the MultiPointToSinglePointIntent class.
- */
-public class TestMultiPointToSinglePointIntent {
-
- private static final ApplicationId APPID = new TestApplicationId("foo");
-
- private ConnectPoint point1 = connectPoint("dev1", 1);
- private ConnectPoint point2 = connectPoint("dev2", 1);
- private ConnectPoint point3 = connectPoint("dev3", 1);
-
- private TrafficSelector selector = new IntentTestsMocks.MockSelector();
- private TrafficTreatment treatment = new IntentTestsMocks.MockTreatment();
-
- Set<ConnectPoint> ingress1;
- Set<ConnectPoint> ingress2;
-
- /**
- * Creates a MultiPointToSinglePointIntent object.
- *
- * @param ingress set of ingress points
- * @param egress egress point
- * @return MultiPointToSinglePoint intent
- */
- private MultiPointToSinglePointIntent makeIntent(Set<ConnectPoint> ingress,
- ConnectPoint egress) {
- return new MultiPointToSinglePointIntent(APPID, selector, treatment,
- ingress, egress);
- }
-
- /**
- * Initializes the ingress sets.
- */
- @Before
- public void setup() {
- ingress1 = new HashSet<>();
- ingress2 = new HashSet<>();
- }
-
- /**
- * Tests the equals() method where two MultiPointToSinglePoint have references
- * to the same Links in different orders. These should compare equal.
- */
- @Test @Ignore("Needs to be merged with other API test")
- public void testSameEquals() {
-
- Set<ConnectPoint> ingress1 = new HashSet<>();
- ingress1.add(point2);
- ingress1.add(point3);
-
- Set<ConnectPoint> ingress2 = new HashSet<>();
- ingress2.add(point3);
- ingress2.add(point2);
-
- Intent i1 = makeIntent(ingress1, point1);
- Intent i2 = makeIntent(ingress2, point1);
-
- assertThat(i1, is(equalTo(i2)));
- }
-
- /**
- * Tests the equals() method where two MultiPointToSinglePoint have references
- * to different Links. These should compare not equal.
- */
- @Test @Ignore("Needs to be merged with other API test")
- public void testLinksDifferentEquals() {
- ingress1.add(point3);
-
- ingress2.add(point3);
- ingress2.add(point2);
-
- Intent i1 = makeIntent(ingress1, point1);
- Intent i2 = makeIntent(ingress2, point1);
-
- assertThat(i1, is(not(equalTo(i2))));
- }
-
- /**
- * Tests that the hashCode() values for two equivalent MultiPointToSinglePoint
- * objects are the same.
- */
- @Test @Ignore("Needs to be merged with other API test")
- public void testHashCodeEquals() {
- ingress1.add(point2);
- ingress1.add(point3);
-
- ingress2.add(point3);
- ingress2.add(point2);
-
- Intent i1 = makeIntent(ingress1, point1);
- Intent i2 = makeIntent(ingress2, point1);
-
- assertThat(i1.hashCode(), is(equalTo(i2.hashCode())));
- }
-
- /**
- * Tests that the hashCode() values for two distinct MultiPointToSinglePoint
- * objects are different.
- */
- @Test @Ignore("Needs to be merged with other API test")
- public void testHashCodeDifferent() {
- ingress1.add(point2);
-
- ingress2.add(point3);
- ingress2.add(point2);
-
- Intent i1 = makeIntent(ingress1, point1);
- Intent i2 = makeIntent(ingress2, point1);
-
-
- assertThat(i1.hashCode(), is(not(equalTo(i2.hashCode()))));
- }
-
- /**
- * Checks that the MultiPointToSinglePointIntent class is immutable.
- */
- @Test
- public void checkImmutability() {
- assertThatClassIsImmutable(MultiPointToSinglePointIntent.class);
- }
-}
diff --git a/core/net/src/test/java/org/onlab/onos/net/intent/TestPointToPointIntent.java b/core/net/src/test/java/org/onlab/onos/net/intent/TestPointToPointIntent.java
deleted file mode 100644
index b1c30bd..0000000
--- a/core/net/src/test/java/org/onlab/onos/net/intent/TestPointToPointIntent.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright 2014 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onlab.onos.net.intent;
-
-import org.junit.Ignore;
-import org.junit.Test;
-import org.onlab.onos.core.ApplicationId;
-import org.onlab.onos.TestApplicationId;
-import org.onlab.onos.net.ConnectPoint;
-import org.onlab.onos.net.flow.TrafficSelector;
-import org.onlab.onos.net.flow.TrafficTreatment;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.*;
-import static org.onlab.onos.net.NetTestTools.connectPoint;
-
-/**
- * Unit tests for the HostToHostIntent class.
- */
-public class TestPointToPointIntent {
-
- private static final ApplicationId APPID = new TestApplicationId("foo");
-
- private TrafficSelector selector = new IntentTestsMocks.MockSelector();
- private TrafficTreatment treatment = new IntentTestsMocks.MockTreatment();
-
- private ConnectPoint point1 = connectPoint("dev1", 1);
- private ConnectPoint point2 = connectPoint("dev2", 1);
-
- private PointToPointIntent makePointToPoint(ConnectPoint ingress,
- ConnectPoint egress) {
- return new PointToPointIntent(APPID, selector, treatment, ingress, egress);
- }
-
- /**
- * Tests the equals() method where two PointToPointIntents have references
- * to the same ingress and egress points. These should compare equal.
- */
- @Test @Ignore("Needs to be merged with other API test")
- public void testSameEquals() {
- PointToPointIntent i1 = makePointToPoint(point1, point2);
- PointToPointIntent i2 = makePointToPoint(point1, point2);
-
- assertThat(i1, is(equalTo(i2)));
- }
-
- /**
- * Tests the equals() method where two HostToHostIntents have references
- * to different Hosts. These should compare not equal.
- */
- @Test @Ignore("Needs to be merged with other API test")
- public void testLinksDifferentEquals() {
- PointToPointIntent i1 = makePointToPoint(point1, point2);
- PointToPointIntent i2 = makePointToPoint(point2, point1);
-
- assertThat(i1, is(not(equalTo(i2))));
- }
-
- /**
- * Tests that the hashCode() values for two equivalent HostToHostIntent
- * objects are the same.
- */
- @Test @Ignore("Needs to be merged with other API test")
- public void testHashCodeEquals() {
- PointToPointIntent i1 = makePointToPoint(point1, point2);
- PointToPointIntent i2 = makePointToPoint(point1, point2);
-
- assertThat(i1.hashCode(), is(equalTo(i2.hashCode())));
- }
-
- /**
- * Tests that the hashCode() values for two distinct LinkCollectionIntent
- * objects are different.
- */
- @Test @Ignore("Needs to be merged with other API test")
- public void testHashCodeDifferent() {
- PointToPointIntent i1 = makePointToPoint(point1, point2);
- PointToPointIntent i2 = makePointToPoint(point2, point1);
-
- assertThat(i1.hashCode(), is(not(equalTo(i2.hashCode()))));
- }
-}
diff --git a/core/net/src/test/java/org/onlab/onos/net/intent/impl/TestHostToHostIntentCompiler.java b/core/net/src/test/java/org/onlab/onos/net/intent/impl/HostToHostIntentCompilerTest.java
similarity index 98%
rename from core/net/src/test/java/org/onlab/onos/net/intent/impl/TestHostToHostIntentCompiler.java
rename to core/net/src/test/java/org/onlab/onos/net/intent/impl/HostToHostIntentCompilerTest.java
index 1ed6032..07cf731 100644
--- a/core/net/src/test/java/org/onlab/onos/net/intent/impl/TestHostToHostIntentCompiler.java
+++ b/core/net/src/test/java/org/onlab/onos/net/intent/impl/HostToHostIntentCompilerTest.java
@@ -46,7 +46,7 @@
/**
* Unit tests for the HostToHost intent compiler.
*/
-public class TestHostToHostIntentCompiler extends AbstractIntentTest {
+public class HostToHostIntentCompilerTest extends AbstractIntentTest {
private static final String HOST_ONE_MAC = "00:00:00:00:00:01";
private static final String HOST_TWO_MAC = "00:00:00:00:00:02";
private static final String HOST_ONE_VLAN = "-1";
diff --git a/core/net/src/test/java/org/onlab/onos/net/intent/impl/TestMultiPointToSinglePointIntentCompiler.java b/core/net/src/test/java/org/onlab/onos/net/intent/impl/MultiPointToSinglePointIntentCompilerTest.java
similarity index 98%
rename from core/net/src/test/java/org/onlab/onos/net/intent/impl/TestMultiPointToSinglePointIntentCompiler.java
rename to core/net/src/test/java/org/onlab/onos/net/intent/impl/MultiPointToSinglePointIntentCompilerTest.java
index 3871de7..3727572 100644
--- a/core/net/src/test/java/org/onlab/onos/net/intent/impl/TestMultiPointToSinglePointIntentCompiler.java
+++ b/core/net/src/test/java/org/onlab/onos/net/intent/impl/MultiPointToSinglePointIntentCompilerTest.java
@@ -47,7 +47,7 @@
/**
* Unit tests for the MultiPointToSinglePoint intent compiler.
*/
-public class TestMultiPointToSinglePointIntentCompiler extends AbstractIntentTest {
+public class MultiPointToSinglePointIntentCompilerTest extends AbstractIntentTest {
private static final ApplicationId APPID = new TestApplicationId("foo");
diff --git a/core/net/src/test/java/org/onlab/onos/net/intent/impl/TestPointToPointIntentCompiler.java b/core/net/src/test/java/org/onlab/onos/net/intent/impl/PointToPointIntentCompilerTest.java
similarity index 98%
rename from core/net/src/test/java/org/onlab/onos/net/intent/impl/TestPointToPointIntentCompiler.java
rename to core/net/src/test/java/org/onlab/onos/net/intent/impl/PointToPointIntentCompilerTest.java
index 3070664..6d76820 100644
--- a/core/net/src/test/java/org/onlab/onos/net/intent/impl/TestPointToPointIntentCompiler.java
+++ b/core/net/src/test/java/org/onlab/onos/net/intent/impl/PointToPointIntentCompilerTest.java
@@ -47,7 +47,7 @@
/**
* Unit tests for the HostToHost intent compiler.
*/
-public class TestPointToPointIntentCompiler extends AbstractIntentTest {
+public class PointToPointIntentCompilerTest extends AbstractIntentTest {
private static final ApplicationId APPID = new TestApplicationId("foo");
diff --git a/utils/misc/src/test/java/org/onlab/packet/IpAddressTest.java b/utils/misc/src/test/java/org/onlab/packet/IpAddressTest.java
index 7d6a5de..7c07b07 100644
--- a/utils/misc/src/test/java/org/onlab/packet/IpAddressTest.java
+++ b/utils/misc/src/test/java/org/onlab/packet/IpAddressTest.java
@@ -15,18 +15,18 @@
*/
package org.onlab.packet;
-import com.google.common.net.InetAddresses;
-import com.google.common.testing.EqualsTester;
-import org.junit.Ignore;
+import java.net.InetAddress;
+
import org.junit.Test;
-import java.net.InetAddress;
+import com.google.common.net.InetAddresses;
+import com.google.common.testing.EqualsTester;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
-import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
+import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutableBaseClass;
/**
* Tests for class {@link IpAddress}.
@@ -35,10 +35,9 @@
/**
* Tests the immutability of {@link IpAddress}.
*/
- @Ignore("The class is not pure immutable, because it is not 'final'")
@Test
public void testImmutable() {
- assertThatClassIsImmutable(IpAddress.class);
+ assertThatClassIsImmutableBaseClass(IpAddress.class);
}
/**
diff --git a/utils/misc/src/test/java/org/onlab/packet/IpPrefixTest.java b/utils/misc/src/test/java/org/onlab/packet/IpPrefixTest.java
index 91a4d49..ba765b1 100644
--- a/utils/misc/src/test/java/org/onlab/packet/IpPrefixTest.java
+++ b/utils/misc/src/test/java/org/onlab/packet/IpPrefixTest.java
@@ -15,17 +15,17 @@
*/
package org.onlab.packet;
-import com.google.common.testing.EqualsTester;
-import org.junit.Ignore;
import org.junit.Test;
+import com.google.common.testing.EqualsTester;
+
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
-import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
+import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutableBaseClass;
/**
* Tests for class {@link IpPrefix}.
@@ -34,10 +34,9 @@
/**
* Tests the immutability of {@link IpPrefix}.
*/
- @Ignore("The class is not pure immutable, because it is not 'final'")
@Test
public void testImmutable() {
- assertThatClassIsImmutable(IpPrefix.class);
+ assertThatClassIsImmutableBaseClass(IpPrefix.class);
}
/**