[vlma-devel] commit: More unit tests. (Adrien Grand )
git version control
git at videolan.org
Sun Nov 9 01:40:40 CET 2008
vlma | branch: master | Adrien Grand <jpountz at videolan.org> | Sat Nov 8 16:48:24 2008 +0100| [fdc6179ff85b0b99bd02882791bab0e37fda43ae] | committer: Adrien Grand
More unit tests.
> http://git.videolan.org/gitweb.cgi/vlma.git/?a=commit;h=fdc6179ff85b0b99bd02882791bab0e37fda43ae
---
.../org/videolan/vlma/model/MediaGroupTest.java | 38 ++++++++++++++++++++
.../java/org/videolan/vlma/model/OrderTest.java | 22 ++++++++++-
2 files changed, 58 insertions(+), 2 deletions(-)
diff --git a/vlma-api/src/test/java/org/videolan/vlma/model/MediaGroupTest.java b/vlma-api/src/test/java/org/videolan/vlma/model/MediaGroupTest.java
index 7761250..00489df 100644
--- a/vlma-api/src/test/java/org/videolan/vlma/model/MediaGroupTest.java
+++ b/vlma-api/src/test/java/org/videolan/vlma/model/MediaGroupTest.java
@@ -44,4 +44,42 @@ public class MediaGroupTest {
assertEquals(group.hashCode(), group2.hashCode());
}
+ @Test
+ public void testAdd() {
+ group = new MediaGroup();
+ Media m1 = new FilesChannel();
+ group.add(m1);
+ try {
+ group.add(new FilesChannel());
+ assertFalse(true);
+ } catch(Exception e) {}
+ }
+
+ @Test
+ public void testAdd2() {
+ group = new MediaGroup();
+ Media m1 = new SatChannel();
+ group.add(m1);
+ try {
+ group.add(new DTTChannel());
+ assertFalse(true);
+ } catch(IllegalArgumentException e) {}
+ }
+
+ @Test
+ public void testAdd3() {
+ group = new MediaGroup();
+ SatChannel m1 = new SatChannel();
+ m1.setFrequency(42);
+ m1.setSid(12);
+ group.add(m1);
+ try {
+ SatChannel m2 = new SatChannel();
+ m2.setFrequency(12);
+ m2.setSid(42);
+ group.add(m2);
+ assertFalse(true);
+ } catch(IllegalArgumentException e) {}
+ }
+
}
diff --git a/vlma-api/src/test/java/org/videolan/vlma/model/OrderTest.java b/vlma-api/src/test/java/org/videolan/vlma/model/OrderTest.java
index 0ab8bb0..0096611 100644
--- a/vlma-api/src/test/java/org/videolan/vlma/model/OrderTest.java
+++ b/vlma-api/src/test/java/org/videolan/vlma/model/OrderTest.java
@@ -42,18 +42,36 @@ public class OrderTest {
MediaGroup group2 = new MediaGroup();
group2.add(media2);
group2.add(media1);
- Adapter adapter = new FilesAdapter();
+ Adapter adapter = new DVBTAdapter();
Server server = new Server();
server.setIp(InetAddress.getLocalHost());
adapter.setName("adapter");
adapter.setServer(server);
- Adapter adapter2 = new FilesAdapter();
+ Adapter adapter2 = new DVBTAdapter();
adapter2.setName("adapter");
adapter2.setServer(server);
order = new Order(adapter, group);
Order order2 = new Order(adapter2, group2);
assertEquals(order, order2);
+ assertEquals(order.getName(), order2.getName());
assertEquals(order.hashCode(), order2.hashCode());
}
+ @Test
+ public void testEquals2() {
+ FilesChannel m1 = new FilesChannel();
+ m1.setName("m1");
+ FilesChannel m2 = new FilesChannel();
+ m2.setName("m2");
+ MediaGroup g1 = new MediaGroup();
+ g1.add(m1);
+ MediaGroup g2 = new MediaGroup();
+ g2.add(m2);
+ Adapter a = new FilesAdapter();
+ a.setName("adapter");
+ order = new Order(a, g1);
+ Order order2 = new Order(a, g2);
+ assertTrue(order.equals(order2));
+ assertTrue(order.getName().equals(order2.getName()));
+ }
}
More information about the vlma-devel
mailing list