1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.fourthline.cling.test.model;
17
18 import org.fourthline.cling.model.meta.DeviceDetails;
19 import org.fourthline.cling.model.meta.Icon;
20 import org.fourthline.cling.model.meta.RemoteDevice;
21 import org.fourthline.cling.model.meta.RemoteService;
22 import org.fourthline.cling.model.types.UDADeviceType;
23 import org.fourthline.cling.test.data.SampleData;
24 import org.testng.annotations.Test;
25
26 import java.net.URI;
27
28 import static org.testng.Assert.*;
29
30
31
32
33 public class IconTest {
34
35 @Test
36 public void validIcons() throws Exception {
37 RemoteDevice rd = new RemoteDevice(
38 SampleData.createRemoteDeviceIdentity(),
39 new UDADeviceType("Foo", 1),
40 new DeviceDetails("Foo"),
41 new Icon[]{
42 new Icon(null, 0, 0, 0, URI.create("foo")),
43 new Icon("foo/bar", 0, 0, 0, URI.create("foo")),
44 new Icon("foo/bar", 123, 456, 0, URI.create("foo"))
45 },
46 new RemoteService[0]
47 );
48 assertEquals(rd.findIcons().length, 3);
49 }
50
51 @Test
52 public void invalidIcons() throws Exception {
53 RemoteDevice rd = new RemoteDevice(
54 SampleData.createRemoteDeviceIdentity(),
55 new UDADeviceType("Foo", 1),
56 new DeviceDetails("Foo"),
57 new Icon[]{
58 new Icon("image/png", 123, 123, 8, URI.create("urn:not_a_URL")),
59 },
60 new RemoteService[0]
61 );
62 assertEquals(rd.findIcons().length, 0);
63 }
64 }