Imported Upstream version 1.0.0
[platform/upstream/iotivity.git] / android / android_api / base / src / androidTest / java / org / iotivity / base / OcRepresentationTest.java
1 /*
2  * //******************************************************************
3  * //
4  * // Copyright 2015 Intel Corporation.
5  * //
6  * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7  * //
8  * // Licensed under the Apache License, Version 2.0 (the "License");
9  * // you may not use this file except in compliance with the License.
10  * // You may obtain a copy of the License at
11  * //
12  * //      http://www.apache.org/licenses/LICENSE-2.0
13  * //
14  * // Unless required by applicable law or agreed to in writing, software
15  * // distributed under the License is distributed on an "AS IS" BASIS,
16  * // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * // See the License for the specific language governing permissions and
18  * // limitations under the License.
19  * //
20  * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
21  */
22
23 package org.iotivity.base;
24
25 import android.test.InstrumentationTestCase;
26
27 import java.security.InvalidParameterException;
28 import java.util.Arrays;
29 import java.util.LinkedList;
30 import java.util.List;
31
32 public class OcRepresentationTest extends InstrumentationTestCase {
33
34     private static final String TAG = "OcRepresentationTest";
35
36     @Override
37     protected void setUp() throws Exception {
38         super.setUp();
39     }
40
41     public void testChildrenManagement() throws OcException {
42         OcRepresentation representation = new OcRepresentation();
43
44         List<OcRepresentation> emptyList = representation.getChildren();
45         assertTrue(emptyList.isEmpty());
46
47         OcRepresentation child1 = new OcRepresentation();
48         OcRepresentation child2 = new OcRepresentation();
49         String key = "key";
50         int value = 75;
51
52         child1.setValue(key, value);
53         child2.setValue(key, value);
54         representation.addChild(child1);
55         representation.addChild(child2);
56         List<OcRepresentation> twoChildren = representation.getChildren();
57         assertEquals(2, twoChildren.size());
58         for (OcRepresentation rep : twoChildren) {
59             assertEquals(value, rep.getValue(key));
60         }
61
62         representation.clearChildren();
63         emptyList = representation.getChildren();
64         assertTrue(emptyList.isEmpty());
65     }
66
67     public void testUriGetSet() {
68         OcRepresentation representation = new OcRepresentation();
69
70         String emptyUri = representation.getUri();
71         assertTrue(emptyUri.isEmpty());
72
73         String expected = "a/resource/uri";
74         representation.setUri(expected);
75         String actual = representation.getUri();
76         assertEquals(expected, actual);
77     }
78
79     public void testResourceTypesGetSet() {
80         OcRepresentation representation = new OcRepresentation();
81
82         List<String> emptyResourceTypeList = representation.getResourceTypes();
83         assertTrue(emptyResourceTypeList.isEmpty());
84
85         representation.setResourceTypes(emptyResourceTypeList);
86         emptyResourceTypeList = representation.getResourceTypes();
87         assertTrue(emptyResourceTypeList.isEmpty());
88
89         List<String> resourceTypeListExpected = new LinkedList<String>();
90         resourceTypeListExpected.add("type1");
91         resourceTypeListExpected.add("type2");
92         resourceTypeListExpected.add("type3");
93
94         representation.setResourceTypes(resourceTypeListExpected);
95         List<String> resourceTypeListActual = representation.getResourceTypes();
96         assertEquals(resourceTypeListExpected.size(), resourceTypeListActual.size());
97         for (int i = 0; i < resourceTypeListExpected.size(); i++) {
98             assertEquals(resourceTypeListExpected.get(i), resourceTypeListActual.get(i));
99         }
100
101         boolean thrown = false;
102         try {
103             representation.setResourceTypes(null);
104         } catch (InvalidParameterException e) {
105             thrown = true;
106         }
107         assertTrue(thrown);
108     }
109
110     public void testResourceInterfacesGetSet() {
111         OcRepresentation representation = new OcRepresentation();
112
113         List<String> emptyResourceInterfaceList = representation.getResourceInterfaces();
114         assertTrue(emptyResourceInterfaceList.isEmpty());
115
116         representation.setResourceInterfaces(emptyResourceInterfaceList);
117         emptyResourceInterfaceList = representation.getResourceInterfaces();
118         assertTrue(emptyResourceInterfaceList.isEmpty());
119
120         List<String> resourceInterfaceListExpected = new LinkedList<String>();
121         resourceInterfaceListExpected.add("Interface1");
122         resourceInterfaceListExpected.add("Interface2");
123         resourceInterfaceListExpected.add("Interface3");
124
125         representation.setResourceInterfaces(resourceInterfaceListExpected);
126         List<String> resourceInterfaceListActual = representation.getResourceInterfaces();
127         assertEquals(resourceInterfaceListExpected.size(), resourceInterfaceListActual.size());
128         for (int i = 0; i < resourceInterfaceListExpected.size(); i++) {
129             assertEquals(resourceInterfaceListExpected.get(i), resourceInterfaceListActual.get(i));
130         }
131
132         boolean thrown = false;
133         try {
134             representation.setResourceInterfaces(null);
135         } catch (InvalidParameterException e) {
136             thrown = true;
137         }
138         assertTrue(thrown);
139     }
140
141     public void testAttributeManagement() {
142         OcRepresentation representation = new OcRepresentation();
143
144         assertTrue(representation.isEmpty());
145         assertEquals(0, representation.size());
146
147         try {
148             String integerKey = "integerKey";
149             int integerValue = 75;
150             representation.setValue(integerKey, integerValue);
151             assertFalse(representation.isEmpty());
152             assertEquals(1, representation.size());
153
154             int actualIntValue = representation.getValue(integerKey);
155             assertEquals(integerValue, actualIntValue);
156
157             String stringKey = "stringKey";
158             String stringValue = "stringValue";
159             representation.setValue(stringKey, stringValue);
160             assertEquals(2, representation.size());
161
162             assertTrue(representation.hasAttribute(integerKey));
163             representation.remove(integerKey);
164             assertFalse(representation.hasAttribute(integerKey));
165             assertEquals(1, representation.size());
166
167             representation.setValue(integerKey, integerValue);
168             assertFalse(representation.isNull(integerKey));
169             representation.setNull(integerKey);
170             assertTrue(representation.isNull(integerKey));
171         } catch (OcException e) {
172             assertTrue(false);
173         }
174
175         String nonexistentKey = "nonexistentKey";
176         assertFalse(representation.hasAttribute(nonexistentKey));
177         representation.setNull(nonexistentKey);
178         assertTrue(representation.isNull(nonexistentKey));
179
180         String nonexistentKey2 = "nonexistentKey2";
181         boolean thrown = false;
182         try {
183             boolean nonexistentValue = representation.getValue(nonexistentKey2);
184         } catch (OcException e) {
185             thrown = true;
186         }
187         assertTrue(thrown);
188     }
189
190     public void testAttributeAccessByType() throws OcException {
191         OcRepresentation rep = new OcRepresentation();
192
193         //null
194         OcRepresentation repNull = null;
195         rep.setValue("nullKey", repNull);
196         OcRepresentation repNullActual = rep.getValue("nullKey");
197         assertNull(repNullActual);
198
199         //integer
200         String intK = "intK";
201         int intV = 4;
202         rep.setValue(intK, intV);
203         int intVa = rep.getValue(intK);
204         assertEquals(intV, intVa);
205
206         //double
207         String doubleK = "doubleK";
208         double doubleV = 4.5;
209         rep.setValue(doubleK, doubleV);
210         double doubleVa = rep.getValue(doubleK);
211         assertEquals(doubleV, doubleVa);
212
213         //boolean
214         String booleanK = "booleanK";
215         boolean booleanV = true;
216         rep.setValue(booleanK, booleanV);
217         boolean booleanVa = rep.getValue(booleanK);
218         assertEquals(booleanV, booleanVa);
219
220         //String
221         String stringK = "stringK";
222         String stringV = "stringV";
223         rep.setValue(stringK, stringV);
224         String stringVa = rep.getValue(stringK);
225         assertEquals(stringV, stringVa);
226
227         //OcRepresentation
228         String repK = "repK";
229         OcRepresentation repV = new OcRepresentation();
230         repV.setValue(intK, intV);
231         rep.setValue(repK, repV);
232         OcRepresentation repVa = rep.getValue(repK);
233         assertEquals(intV, repVa.getValue(intK));
234     }
235
236     public void testAttributeAccessBySequenceType() throws OcException {
237         OcRepresentation rep = new OcRepresentation();
238
239         //integer
240         String intK = "intK";
241         int[] intArrV = {1, 2, 3, 4};
242         rep.setValue(intK, intArrV);
243         int[] intArrVa = rep.getValue(intK);
244         assertTrue(Arrays.equals(intArrV, intArrVa));
245
246         int[] intArrVEmpty = {};
247         rep.setValue(intK, intArrVEmpty);
248         int[] intArrVEmptyA = rep.getValue(intK);
249         assertTrue(Arrays.equals(intArrVEmpty, intArrVEmptyA));
250
251         //double
252         String doubleK = "doubleK";
253         double[] doubleArrV = {1.1, 2.2, 3.3, 4.4};
254         rep.setValue(doubleK, doubleArrV);
255         double[] doubleArrVa = rep.getValue(doubleK);
256         assertTrue(Arrays.equals(doubleArrV, doubleArrVa));
257
258         double[] doubleArrVEmpty = {};
259         rep.setValue(doubleK, doubleArrVEmpty);
260         double[] doubleArrVEmptyA = rep.getValue(doubleK);
261         assertTrue(Arrays.equals(doubleArrVEmpty, doubleArrVEmptyA));
262
263         //boolean
264         String booleanK = "booleanK";
265         boolean[] booleanArrV = {true, false, true, false};
266         rep.setValue(booleanK, booleanArrV);
267         boolean[] booleanArrVa = rep.getValue(booleanK);
268         assertTrue(Arrays.equals(booleanArrV, booleanArrVa));
269
270         boolean[] booleanArrVEmpty = {};
271         rep.setValue(booleanK, booleanArrVEmpty);
272         boolean[] booleanArrVEmptyA = rep.getValue(booleanK);
273         assertTrue(Arrays.equals(booleanArrVEmpty, booleanArrVEmptyA));
274
275         //String
276         String stringK = "stringK";
277         String[] stringArrV = {"aaa", "bbb", "ccc", "ddd"};
278         rep.setValue(stringK, stringArrV);
279         String[] stringArrVa = rep.getValue(stringK);
280         assertTrue(Arrays.equals(stringArrV, stringArrVa));
281
282         String[] stringArrVEmpty = {};
283         rep.setValue(stringK, stringArrVEmpty);
284         String[] stringArrVEmptyA = rep.getValue(stringK);
285         assertTrue(Arrays.equals(stringArrVEmpty, stringArrVEmptyA));
286
287         //OcRepresentation
288         String representationK = "representationK";
289         OcRepresentation[] representationArrV = {
290                 new OcRepresentation(),
291                 new OcRepresentation(),
292                 new OcRepresentation(),
293                 new OcRepresentation()};
294         representationArrV[0].setValue(intK, 0);
295         representationArrV[1].setValue(intK, 1);
296         representationArrV[2].setValue(intK, 2);
297         representationArrV[3].setValue(intK, 3);
298
299         rep.setValue(representationK, representationArrV);
300         OcRepresentation[] representationArrVa = rep.getValue(representationK);
301
302         assertEquals(representationArrV.length, representationArrVa.length);
303         for (int i = 0; i < representationArrV.length; ++i) {
304             assertEquals(representationArrV[i].getValue(intK),
305                     representationArrVa[i].getValue(intK));
306         }
307
308         OcRepresentation[] representationArrVEmpty = {};
309         rep.setValue(representationK, representationArrVEmpty);
310         OcRepresentation[] representationArrVEmptyA = rep.getValue(representationK);
311         assertEquals(representationArrVEmpty.length, representationArrVEmptyA.length);
312     }
313
314     public void testAttributeAccessBy2DType() throws OcException {
315         OcRepresentation rep = new OcRepresentation();
316         //integer
317         String int2DK = "int2DK";
318         int[] intArrV1 = {1, 2, 3, 4};
319         int[] intArrV2 = {5, 6, 7, 8};
320         int[][] int2DArrV = {intArrV1, intArrV2};
321         rep.setValue(int2DK, int2DArrV);
322         int[][] int2DArrVa = rep.getValue(int2DK);
323         for (int i = 0; i < int2DArrV.length; i++) {
324             assertTrue(Arrays.equals(int2DArrV[i], int2DArrVa[i]));
325         }
326         //double
327         String double2DK = "double2DK";
328         double[] doubleArrV1 = {1.1, 2.2, 3.3, 4.4};
329         double[] doubleArrV2 = {5, 6, 7, 8};
330         double[][] double2DArrV = {doubleArrV1, doubleArrV2};
331         rep.setValue(double2DK, double2DArrV);
332         double[][] double2DArrVa = rep.getValue(double2DK);
333         for (int i = 0; i < double2DArrV.length; i++) {
334             assertTrue(Arrays.equals(double2DArrV[i], double2DArrVa[i]));
335         }
336         double[][] double2DArrVEmpty = {{}};
337         rep.setValue(double2DK, double2DArrVEmpty);
338         double[][] double2DArrVEmptyA = rep.getValue(double2DK);
339         for (int i = 0; i < double2DArrVEmpty.length; i++) {
340             assertTrue(Arrays.equals(double2DArrVEmpty[i], double2DArrVEmptyA[i]));
341         }
342         //boolean
343         String boolean2DK = "boolean2DK";
344         boolean[] booleanArrV1 = {true, true, false};
345         boolean[] booleanArrV2 = {true, false, false, true};
346         boolean[][] boolean2DArrV = {booleanArrV1, booleanArrV2};
347         rep.setValue(boolean2DK, boolean2DArrV);
348         boolean[][] boolean2DArrVa = rep.getValue(boolean2DK);
349         for (int i = 0; i < boolean2DArrV.length; i++) {
350             assertTrue(Arrays.equals(boolean2DArrV[i], boolean2DArrVa[i]));
351         }
352         boolean[][] boolean2DArrVEmpty = {{}};
353         rep.setValue(boolean2DK, boolean2DArrVEmpty);
354         boolean[][] boolean2DArrVEmptyA = rep.getValue(boolean2DK);
355         for (int i = 0; i < boolean2DArrVEmpty.length; i++) {
356             assertTrue(Arrays.equals(boolean2DArrVEmpty[i], boolean2DArrVEmptyA[i]));
357         }
358
359         //String
360         String string2DK = "string2DK";
361         String[] stringArrV1 = {"aaa", "bbb", "ccc"};
362         String[] stringArrV2 = {"111", "222", "333", "444"};
363         String[][] string2DArrV = {stringArrV1, stringArrV2};
364         rep.setValue(string2DK, string2DArrV);
365         String[][] string2DArrVa = rep.getValue(string2DK);
366         for (int i = 0; i < string2DArrV.length; i++) {
367             assertTrue(Arrays.equals(string2DArrV[i], string2DArrVa[i]));
368         }
369         String[][] string2DArrVEmpty = {{}};
370         rep.setValue(string2DK, string2DArrVEmpty);
371         String[][] string2DArrVEmptyA = rep.getValue(string2DK);
372         for (int i = 0; i < string2DArrVEmpty.length; i++) {
373             assertTrue(Arrays.equals(string2DArrVEmpty[i], string2DArrVEmptyA[i]));
374         }
375
376         //OcRepresentation
377         String intK = "intK";
378         String representation2DK = "representation2DK";
379         OcRepresentation[] representation2DArrV1 = {
380                 new OcRepresentation(),
381                 new OcRepresentation(),
382                 new OcRepresentation(),
383                 new OcRepresentation()};
384         representation2DArrV1[0].setValue(intK, 0);
385         representation2DArrV1[1].setValue(intK, 1);
386         representation2DArrV1[2].setValue(intK, 2);
387         representation2DArrV1[3].setValue(intK, 3);
388
389         OcRepresentation[] representation2DArrV2 = {
390                 new OcRepresentation(),
391                 new OcRepresentation(),
392                 new OcRepresentation(),
393                 new OcRepresentation()};
394         representation2DArrV2[0].setValue(intK, 4);
395         representation2DArrV2[1].setValue(intK, 5);
396         representation2DArrV2[2].setValue(intK, 6);
397         representation2DArrV2[3].setValue(intK, 7);
398
399         OcRepresentation[][] representation2DArrV = {representation2DArrV1, representation2DArrV2};
400         rep.setValue(representation2DK, representation2DArrV);
401         OcRepresentation[][] representation2DArrVa = rep.getValue(representation2DK);
402         assertEquals(representation2DArrV.length, representation2DArrVa.length);
403         for (int i = 0; i < representation2DArrV.length; ++i) {
404             OcRepresentation[] repArrV = representation2DArrV[i];
405             OcRepresentation[] repArrVa = representation2DArrVa[i];
406             assertEquals(repArrV.length, repArrVa.length);
407             for (int j = 0; j < representation2DArrV.length; ++j) {
408                 assertEquals(repArrV[j].getValue(intK),
409                         repArrVa[j].getValue(intK));
410             }
411         }
412
413         OcRepresentation[][] representation2DArrVEmpty = {{}};
414         rep.setValue(representation2DK, representation2DArrVEmpty);
415         OcRepresentation[][] representation2DArrVEmptyA = rep.getValue(representation2DK);
416         assertEquals(representation2DArrVEmpty.length, representation2DArrVEmptyA.length);
417     }
418
419     public void testAttributeAccessBy3DType() throws OcException {
420         OcRepresentation rep = new OcRepresentation();
421         //integer
422         String int3DK = "int3DK";
423         int[] intArrV1 = {0, 1, 2, 3, 4};
424         int[] intArrV2 = {5, 6, 7, 8};
425         int[][] int2DArrV1 = {intArrV1, intArrV2};
426         int[] intArrV3 = {9, 10};
427         int[] intArrV4 = {11};
428         int[][] int2DArrV2 = {intArrV3, intArrV4};
429         int[][][] int3DArrV = {int2DArrV1, int2DArrV2};
430         rep.setValue(int3DK, int3DArrV);
431         int[][][] int3DArrVa = rep.getValue(int3DK);
432         assertEquals(int3DArrV.length, int3DArrVa.length);
433         for (int i = 0; i < int3DArrV.length; i++) {
434             int[][] int2DT = int3DArrV[i];
435             int[][] int2DTa = int3DArrVa[i];
436             assertEquals(int2DT.length, int2DTa.length);
437             for (int j = 0; j < int2DT.length; j++) {
438                 assertTrue(Arrays.equals(int2DT[j], int2DTa[j]));
439             }
440         }
441         //double
442         String double3DK = "double3DK";
443         double[] doubleArrV1 = {0.0, 1.1, 2.2, 3.3, 4.4};
444         double[] doubleArrV2 = {5.5, 6.6, 7.7, 8.8};
445         double[][] double2DArrV1 = {doubleArrV1, doubleArrV2};
446         double[] doubleArrV3 = {9.9, 10.1};
447         double[] doubleArrV4 = {11.1};
448         double[][] double2DArrV2 = {doubleArrV3, doubleArrV4};
449         double[][][] double3DArrV = {double2DArrV1, double2DArrV2};
450         rep.setValue(double3DK, double3DArrV);
451         double[][][] double3DArrVa = rep.getValue(double3DK);
452         assertEquals(double3DArrV.length, double3DArrVa.length);
453         for (int i = 0; i < double3DArrV.length; i++) {
454             double[][] double2DT = double3DArrV[i];
455             double[][] double2DTa = double3DArrVa[i];
456             assertEquals(double2DT.length, double2DTa.length);
457             for (int j = 0; j < double2DT.length; j++) {
458                 assertTrue(Arrays.equals(double2DT[j], double2DTa[j]));
459             }
460         }
461         double[][][] double3DArrVEmpty = {};
462         rep.setValue(double3DK, double3DArrVEmpty);
463         double[][][] double3DArrVEmptyA = rep.getValue(double3DK);
464         assertEquals(double3DArrVEmpty.length, double3DArrVEmptyA.length);
465         for (int i = 0; i < double3DArrVEmpty.length; i++) {
466             double[][] double2DT = double3DArrVEmpty[i];
467             double[][] double2DTa = double3DArrVEmptyA[i];
468             assertEquals(double2DT.length, double2DTa.length);
469             for (int j = 0; j < double2DT.length; j++) {
470                 assertTrue(Arrays.equals(double2DT[j], double2DTa[j]));
471             }
472         }
473
474         //boolean
475         String boolean3DK = "boolean3DK";
476         boolean[] booleanArrV1 = {true, false, true, true, false};
477         boolean[] booleanArrV2 = {false, false, false, true};
478         boolean[][] boolean2DArrV1 = {booleanArrV1, booleanArrV2};
479         boolean[] booleanArrV3 = {true, true};
480         boolean[] booleanArrV4 = {false};
481         boolean[][] boolean2DArrV2 = {booleanArrV3, booleanArrV4};
482         boolean[][][] boolean3DArrV = {boolean2DArrV1, boolean2DArrV2};
483         rep.setValue(boolean3DK, boolean3DArrV);
484         boolean[][][] boolean3DArrVa = rep.getValue(boolean3DK);
485         assertEquals(boolean3DArrV.length, boolean3DArrVa.length);
486         for (int i = 0; i < boolean3DArrV.length; i++) {
487             boolean[][] boolean2DT = boolean3DArrV[i];
488             boolean[][] boolean2DTa = boolean3DArrVa[i];
489             assertEquals(boolean2DT.length, boolean2DTa.length);
490             for (int j = 0; j < boolean2DT.length; j++) {
491                 assertTrue(Arrays.equals(boolean2DT[j], boolean2DTa[j]));
492             }
493         }
494         boolean[][][] boolean3DArrVEmpty = {};
495         rep.setValue(boolean3DK, boolean3DArrVEmpty);
496         boolean[][][] boolean3DArrVEmptyA = rep.getValue(boolean3DK);
497         assertEquals(boolean3DArrVEmpty.length, boolean3DArrVEmptyA.length);
498         for (int i = 0; i < boolean3DArrVEmpty.length; i++) {
499             boolean[][] boolean2DT = boolean3DArrVEmpty[i];
500             boolean[][] boolean2DTa = boolean3DArrVEmptyA[i];
501             assertEquals(boolean2DT.length, boolean2DTa.length);
502             for (int j = 0; j < boolean2DT.length; j++) {
503                 assertTrue(Arrays.equals(boolean2DT[j], boolean2DTa[j]));
504             }
505         }
506
507         //String
508         String string3DK = "string3DK";
509         String[] stringArrV1 = {"a", "bb", "ccc", "dddd", "eeee"};
510         String[] stringArrV2 = {"f", "gg", "hhh", "ii"};
511         String[][] string2DArrV1 = {stringArrV1, stringArrV2};
512         String[] stringArrV3 = {"j", "jj"};
513         String[] stringArrV4 = {"jjj"};
514         String[][] string2DArrV2 = {stringArrV3, stringArrV4};
515         String[][][] string3DArrV = {string2DArrV1, string2DArrV2};
516         rep.setValue(string3DK, string3DArrV);
517         String[][][] string3DArrVa = rep.getValue(string3DK);
518         assertEquals(string3DArrV.length, string3DArrVa.length);
519         for (int i = 0; i < string3DArrV.length; i++) {
520             String[][] string2DT = string3DArrV[i];
521             String[][] string2DTa = string3DArrVa[i];
522             assertEquals(string2DT.length, string2DTa.length);
523             for (int j = 0; j < string2DT.length; j++) {
524                 assertTrue(Arrays.equals(string2DT[j], string2DTa[j]));
525             }
526         }
527         String[][][] string3DArrVEmpty = {};
528         rep.setValue(string3DK, string3DArrVEmpty);
529         String[][][] string3DArrVEmptyA = rep.getValue(string3DK);
530         assertEquals(string3DArrVEmpty.length, string3DArrVEmptyA.length);
531         for (int i = 0; i < string3DArrVEmpty.length; i++) {
532             String[][] string2DT = string3DArrVEmpty[i];
533             String[][] string2DTa = string3DArrVEmptyA[i];
534             assertEquals(string2DT.length, string2DTa.length);
535             for (int j = 0; j < string2DT.length; j++) {
536                 assertTrue(Arrays.equals(string2DT[j], string2DTa[j]));
537             }
538         }
539
540         //OcRepresentation
541         String intK = "intK";
542         String representation3DK = "representation3DK";
543         OcRepresentation[] representation2DArrV1 = {
544                 new OcRepresentation(),
545                 new OcRepresentation(),
546                 new OcRepresentation(),
547                 new OcRepresentation()};
548         representation2DArrV1[0].setValue(intK, 0);
549         representation2DArrV1[1].setValue(intK, 1);
550         representation2DArrV1[2].setValue(intK, 2);
551         representation2DArrV1[3].setValue(intK, 3);
552
553         OcRepresentation[] representation2DArrV2 = {
554                 new OcRepresentation(),
555                 new OcRepresentation(),
556                 new OcRepresentation(),
557                 new OcRepresentation()};
558         representation2DArrV2[0].setValue(intK, 4);
559         representation2DArrV2[1].setValue(intK, 5);
560         representation2DArrV2[2].setValue(intK, 6);
561         representation2DArrV2[3].setValue(intK, 7);
562
563         OcRepresentation[][] representation2DArrV = {representation2DArrV1, representation2DArrV2};
564         OcRepresentation[][][] representation3DArrV = {representation2DArrV, representation2DArrV};
565
566         rep.setValue(representation3DK, representation3DArrV);
567         OcRepresentation[][][] representation3DArrVa = rep.getValue(representation3DK);
568         assertEquals(representation3DArrV.length, representation3DArrVa.length);
569         for (int i = 0; i < representation3DArrV.length; ++i) {
570             OcRepresentation[][] repArr2V = representation3DArrV[i];
571             OcRepresentation[][] repArr2Va = representation3DArrVa[i];
572             assertEquals(repArr2V.length, repArr2Va.length);
573             for (int j = 0; j < repArr2V.length; ++j) {
574                 OcRepresentation[] repArrV = repArr2V[j];
575                 OcRepresentation[] repArrVa = repArr2Va[j];
576                 assertEquals(repArrV.length, repArrVa.length);
577                 for (int k = 0; k < repArrV.length; ++k) {
578                     assertEquals(repArrV[k].getValue(intK), repArrVa[k].getValue(intK));
579                 }
580             }
581         }
582     }
583 }