Clean up some SonarQube warnings (trailing whitespace, etc).
[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 testJSONRepresentation() throws OcException {
80         OcRepresentation representation = new OcRepresentation();
81         String key = "key";
82         int value = 75;
83
84         String emptyJson1 = representation.getJSONRepresentation();
85         representation.setValue(key, value);
86         String intValue1 = representation.getJSONRepresentation();
87         representation.remove(key);
88         String emptyJson2 = representation.getJSONRepresentation();
89         assertEquals(emptyJson1, emptyJson2);
90         representation.setValue(key, value);
91         String intValue2 = representation.getJSONRepresentation();
92         assertEquals(intValue1, intValue2);
93     }
94
95     public void testResourceTypesGetSet() {
96         OcRepresentation representation = new OcRepresentation();
97
98         List<String> emptyResourceTypeList = representation.getResourceTypes();
99         assertTrue(emptyResourceTypeList.isEmpty());
100
101         representation.setResourceTypes(emptyResourceTypeList);
102         emptyResourceTypeList = representation.getResourceTypes();
103         assertTrue(emptyResourceTypeList.isEmpty());
104
105         List<String> resourceTypeListExpected = new LinkedList<String>();
106         resourceTypeListExpected.add("type1");
107         resourceTypeListExpected.add("type2");
108         resourceTypeListExpected.add("type3");
109
110         representation.setResourceTypes(resourceTypeListExpected);
111         List<String> resourceTypeListActual = representation.getResourceTypes();
112         assertEquals(resourceTypeListExpected.size(), resourceTypeListActual.size());
113         for (int i = 0; i < resourceTypeListExpected.size(); i++) {
114             assertEquals(resourceTypeListExpected.get(i), resourceTypeListActual.get(i));
115         }
116
117         boolean thrown = false;
118         try {
119             representation.setResourceTypes(null);
120         } catch (InvalidParameterException e) {
121             thrown = true;
122         }
123         assertTrue(thrown);
124     }
125
126     public void testResourceInterfacesGetSet() {
127         OcRepresentation representation = new OcRepresentation();
128
129         List<String> emptyResourceInterfaceList = representation.getResourceInterfaces();
130         assertTrue(emptyResourceInterfaceList.isEmpty());
131
132         representation.setResourceInterfaces(emptyResourceInterfaceList);
133         emptyResourceInterfaceList = representation.getResourceInterfaces();
134         assertTrue(emptyResourceInterfaceList.isEmpty());
135
136         List<String> resourceInterfaceListExpected = new LinkedList<String>();
137         resourceInterfaceListExpected.add("Interface1");
138         resourceInterfaceListExpected.add("Interface2");
139         resourceInterfaceListExpected.add("Interface3");
140
141         representation.setResourceInterfaces(resourceInterfaceListExpected);
142         List<String> resourceInterfaceListActual = representation.getResourceInterfaces();
143         assertEquals(resourceInterfaceListExpected.size(), resourceInterfaceListActual.size());
144         for (int i = 0; i < resourceInterfaceListExpected.size(); i++) {
145             assertEquals(resourceInterfaceListExpected.get(i), resourceInterfaceListActual.get(i));
146         }
147
148         boolean thrown = false;
149         try {
150             representation.setResourceInterfaces(null);
151         } catch (InvalidParameterException e) {
152             thrown = true;
153         }
154         assertTrue(thrown);
155     }
156
157     public void testAttributeManagement() {
158         OcRepresentation representation = new OcRepresentation();
159
160         assertTrue(representation.isEmpty());
161         assertEquals(0, representation.size());
162
163         try {
164             String integerKey = "integerKey";
165             int integerValue = 75;
166             representation.setValue(integerKey, integerValue);
167             assertFalse(representation.isEmpty());
168             assertEquals(1, representation.size());
169
170             int actualIntValue = representation.getValue(integerKey);
171             assertEquals(integerValue, actualIntValue);
172
173             String stringKey = "stringKey";
174             String stringValue = "stringValue";
175             representation.setValue(stringKey, stringValue);
176             assertEquals(2, representation.size());
177
178             assertTrue(representation.hasAttribute(integerKey));
179             representation.remove(integerKey);
180             assertFalse(representation.hasAttribute(integerKey));
181             assertEquals(1, representation.size());
182
183             representation.setValue(integerKey, integerValue);
184             assertFalse(representation.isNull(integerKey));
185             representation.setNull(integerKey);
186             assertTrue(representation.isNull(integerKey));
187         } catch (OcException e) {
188             assertTrue(false);
189         }
190
191         String nonexistentKey = "nonexistentKey";
192         assertFalse(representation.hasAttribute(nonexistentKey));
193         representation.setNull(nonexistentKey);
194         assertTrue(representation.isNull(nonexistentKey));
195
196         String nonexistentKey2 = "nonexistentKey2";
197         boolean thrown = false;
198         try {
199             boolean nonexistentValue = representation.getValue(nonexistentKey2);
200         } catch (OcException e) {
201             thrown = true;
202         }
203         assertTrue(thrown);
204     }
205
206     public void testAttributeAccessByType() throws OcException {
207         OcRepresentation rep = new OcRepresentation();
208
209         //integer
210         String intK = "intK";
211         int intV = 4;
212         rep.setValue(intK, intV);
213         int intVa = rep.getValue(intK);
214         assertEquals(intV, intVa);
215
216         //double
217         String doubleK = "doubleK";
218         double doubleV = 4.5;
219         rep.setValue(doubleK, doubleV);
220         double doubleVa = rep.getValue(doubleK);
221         assertEquals(doubleV, doubleVa);
222
223         //boolean
224         String booleanK = "booleanK";
225         boolean booleanV = true;
226         rep.setValue(booleanK, booleanV);
227         boolean booleanVa = rep.getValue(booleanK);
228         assertEquals(booleanV, booleanVa);
229
230         //String
231         String stringK = "stringK";
232         String stringV = "stringV";
233         rep.setValue(stringK, stringV);
234         String stringVa = rep.getValue(stringK);
235         assertEquals(stringV, stringVa);
236
237         //OcRepresentation
238         String repK = "repK";
239         OcRepresentation repV = new OcRepresentation();
240         repV.setValue(intK, intV);
241         rep.setValue(repK, repV);
242         OcRepresentation repVa = rep.getValue(repK);
243         assertEquals(intV, repVa.getValue(intK));
244     }
245
246     public void testAttributeAccessBySequenceType() throws OcException {
247         OcRepresentation rep = new OcRepresentation();
248
249         //integer
250         String intK = "intK";
251         int[] intArrV = {1, 2, 3, 4};
252         rep.setValue(intK, intArrV);
253         int[] intArrVa = rep.getValue(intK);
254         assertTrue(Arrays.equals(intArrV, intArrVa));
255
256         int[] intArrVEmpty = {};
257         rep.setValue(intK, intArrVEmpty);
258         int[] intArrVEmptyA = rep.getValue(intK);
259         assertTrue(Arrays.equals(intArrVEmpty, intArrVEmptyA));
260
261         //double
262         String doubleK = "doubleK";
263         double[] doubleArrV = {1.1, 2.2, 3.3, 4.4};
264         rep.setValue(doubleK, doubleArrV);
265         double[] doubleArrVa = rep.getValue(doubleK);
266         assertTrue(Arrays.equals(doubleArrV, doubleArrVa));
267
268         double[] doubleArrVEmpty = {};
269         rep.setValue(doubleK, doubleArrVEmpty);
270         double[] doubleArrVEmptyA = rep.getValue(doubleK);
271         assertTrue(Arrays.equals(doubleArrVEmpty, doubleArrVEmptyA));
272
273         //boolean
274         String booleanK = "booleanK";
275         boolean[] booleanArrV = {true, false, true, false};
276         rep.setValue(booleanK, booleanArrV);
277         boolean[] booleanArrVa = rep.getValue(booleanK);
278         assertTrue(Arrays.equals(booleanArrV, booleanArrVa));
279
280         boolean[] booleanArrVEmpty = {};
281         rep.setValue(booleanK, booleanArrVEmpty);
282         boolean[] booleanArrVEmptyA = rep.getValue(booleanK);
283         assertTrue(Arrays.equals(booleanArrVEmpty, booleanArrVEmptyA));
284
285         //String
286         String stringK = "stringK";
287         String[] stringArrV = {"aaa", "bbb", "ccc", "ddd"};
288         rep.setValue(stringK, stringArrV);
289         String[] stringArrVa = rep.getValue(stringK);
290         assertTrue(Arrays.equals(stringArrV, stringArrVa));
291
292         String[] stringArrVEmpty = {};
293         rep.setValue(stringK, stringArrVEmpty);
294         String[] stringArrVEmptyA = rep.getValue(stringK);
295         assertTrue(Arrays.equals(stringArrVEmpty, stringArrVEmptyA));
296
297         //OcRepresentation
298         String representationK = "representationK";
299         OcRepresentation[] representationArrV = {
300                 new OcRepresentation(),
301                 new OcRepresentation(),
302                 new OcRepresentation(),
303                 new OcRepresentation()};
304         representationArrV[0].setValue(intK, 0);
305         representationArrV[1].setValue(intK, 1);
306         representationArrV[2].setValue(intK, 2);
307         representationArrV[3].setValue(intK, 3);
308
309         rep.setValue(representationK, representationArrV);
310         OcRepresentation[] representationArrVa = rep.getValue(representationK);
311
312         assertEquals(representationArrV.length, representationArrVa.length);
313         for (int i = 0; i < representationArrV.length; ++i) {
314             assertEquals(representationArrV[i].getValue(intK),
315                     representationArrVa[i].getValue(intK));
316         }
317
318         OcRepresentation[] representationArrVEmpty = {};
319         rep.setValue(representationK, representationArrVEmpty);
320         OcRepresentation[] representationArrVEmptyA = rep.getValue(representationK);
321         assertEquals(representationArrVEmpty.length, representationArrVEmptyA.length);
322     }
323
324     public void testAttributeAccessBy2DType() throws OcException {
325         OcRepresentation rep = new OcRepresentation();
326         //integer
327         String int2DK = "int2DK";
328         int[] intArrV1 = {1, 2, 3, 4};
329         int[] intArrV2 = {5, 6, 7, 8};
330         int[][] int2DArrV = {intArrV1, intArrV2};
331         rep.setValue(int2DK, int2DArrV);
332         int[][] int2DArrVa = rep.getValue(int2DK);
333         for (int i = 0; i < int2DArrV.length; i++) {
334             assertTrue(Arrays.equals(int2DArrV[i], int2DArrVa[i]));
335         }
336         //double
337         String double2DK = "double2DK";
338         double[] doubleArrV1 = {1.1, 2.2, 3.3, 4.4};
339         double[] doubleArrV2 = {5, 6, 7, 8};
340         double[][] double2DArrV = {doubleArrV1, doubleArrV2};
341         rep.setValue(double2DK, double2DArrV);
342         double[][] double2DArrVa = rep.getValue(double2DK);
343         for (int i = 0; i < double2DArrV.length; i++) {
344             assertTrue(Arrays.equals(double2DArrV[i], double2DArrVa[i]));
345         }
346         double[][] double2DArrVEmpty = {{}};
347         rep.setValue(double2DK, double2DArrVEmpty);
348         double[][] double2DArrVEmptyA = rep.getValue(double2DK);
349         for (int i = 0; i < double2DArrVEmpty.length; i++) {
350             assertTrue(Arrays.equals(double2DArrVEmpty[i], double2DArrVEmptyA[i]));
351         }
352         //boolean
353         String boolean2DK = "boolean2DK";
354         boolean[] booleanArrV1 = {true, true, false};
355         boolean[] booleanArrV2 = {true, false, false, true};
356         boolean[][] boolean2DArrV = {booleanArrV1, booleanArrV2};
357         rep.setValue(boolean2DK, boolean2DArrV);
358         boolean[][] boolean2DArrVa = rep.getValue(boolean2DK);
359         for (int i = 0; i < boolean2DArrV.length; i++) {
360             assertTrue(Arrays.equals(boolean2DArrV[i], boolean2DArrVa[i]));
361         }
362         boolean[][] boolean2DArrVEmpty = {{}};
363         rep.setValue(boolean2DK, boolean2DArrVEmpty);
364         boolean[][] boolean2DArrVEmptyA = rep.getValue(boolean2DK);
365         for (int i = 0; i < boolean2DArrVEmpty.length; i++) {
366             assertTrue(Arrays.equals(boolean2DArrVEmpty[i], boolean2DArrVEmptyA[i]));
367         }
368
369         //String
370         String string2DK = "string2DK";
371         String[] stringArrV1 = {"aaa", "bbb", "ccc"};
372         String[] stringArrV2 = {"111", "222", "333", "444"};
373         String[][] string2DArrV = {stringArrV1, stringArrV2};
374         rep.setValue(string2DK, string2DArrV);
375         String[][] string2DArrVa = rep.getValue(string2DK);
376         for (int i = 0; i < string2DArrV.length; i++) {
377             assertTrue(Arrays.equals(string2DArrV[i], string2DArrVa[i]));
378         }
379         String[][] string2DArrVEmpty = {{}};
380         rep.setValue(string2DK, string2DArrVEmpty);
381         String[][] string2DArrVEmptyA = rep.getValue(string2DK);
382         for (int i = 0; i < string2DArrVEmpty.length; i++) {
383             assertTrue(Arrays.equals(string2DArrVEmpty[i], string2DArrVEmptyA[i]));
384         }
385
386         //OcRepresentation
387         String intK = "intK";
388         String representation2DK = "representation2DK";
389         OcRepresentation[] representation2DArrV1 = {
390                 new OcRepresentation(),
391                 new OcRepresentation(),
392                 new OcRepresentation(),
393                 new OcRepresentation()};
394         representation2DArrV1[0].setValue(intK, 0);
395         representation2DArrV1[1].setValue(intK, 1);
396         representation2DArrV1[2].setValue(intK, 2);
397         representation2DArrV1[3].setValue(intK, 3);
398
399         OcRepresentation[] representation2DArrV2 = {
400                 new OcRepresentation(),
401                 new OcRepresentation(),
402                 new OcRepresentation(),
403                 new OcRepresentation()};
404         representation2DArrV2[0].setValue(intK, 4);
405         representation2DArrV2[1].setValue(intK, 5);
406         representation2DArrV2[2].setValue(intK, 6);
407         representation2DArrV2[3].setValue(intK, 7);
408
409         OcRepresentation[][] representation2DArrV = {representation2DArrV1, representation2DArrV2};
410         rep.setValue(representation2DK, representation2DArrV);
411         OcRepresentation[][] representation2DArrVa = rep.getValue(representation2DK);
412         assertEquals(representation2DArrV.length, representation2DArrVa.length);
413         for (int i = 0; i < representation2DArrV.length; ++i) {
414             OcRepresentation[] repArrV = representation2DArrV[i];
415             OcRepresentation[] repArrVa = representation2DArrVa[i];
416             assertEquals(repArrV.length, repArrVa.length);
417             for (int j = 0; j < representation2DArrV.length; ++j) {
418                 assertEquals(repArrV[j].getValue(intK),
419                         repArrVa[j].getValue(intK));
420             }
421         }
422
423         OcRepresentation[][] representation2DArrVEmpty = {{}};
424         rep.setValue(representation2DK, representation2DArrVEmpty);
425         OcRepresentation[][] representation2DArrVEmptyA = rep.getValue(representation2DK);
426         assertEquals(representation2DArrVEmpty.length, representation2DArrVEmptyA.length);
427     }
428
429     public void testAttributeAccessBy3DType() throws OcException {
430         OcRepresentation rep = new OcRepresentation();
431         //integer
432         String int3DK = "int3DK";
433         int[] intArrV1 = {0, 1, 2, 3, 4};
434         int[] intArrV2 = {5, 6, 7, 8};
435         int[][] int2DArrV1 = {intArrV1, intArrV2};
436         int[] intArrV3 = {9, 10};
437         int[] intArrV4 = {11};
438         int[][] int2DArrV2 = {intArrV3, intArrV4};
439         int[][][] int3DArrV = {int2DArrV1, int2DArrV2};
440         rep.setValue(int3DK, int3DArrV);
441         int[][][] int3DArrVa = rep.getValue(int3DK);
442         assertEquals(int3DArrV.length, int3DArrVa.length);
443         for (int i = 0; i < int3DArrV.length; i++) {
444             int[][] int2DT = int3DArrV[i];
445             int[][] int2DTa = int3DArrVa[i];
446             assertEquals(int2DT.length, int2DTa.length);
447             for (int j = 0; j < int2DT.length; j++) {
448                 assertTrue(Arrays.equals(int2DT[j], int2DTa[j]));
449             }
450         }
451         //double
452         String double3DK = "double3DK";
453         double[] doubleArrV1 = {0.0, 1.1, 2.2, 3.3, 4.4};
454         double[] doubleArrV2 = {5.5, 6.6, 7.7, 8.8};
455         double[][] double2DArrV1 = {doubleArrV1, doubleArrV2};
456         double[] doubleArrV3 = {9.9, 10.1};
457         double[] doubleArrV4 = {11.1};
458         double[][] double2DArrV2 = {doubleArrV3, doubleArrV4};
459         double[][][] double3DArrV = {double2DArrV1, double2DArrV2};
460         rep.setValue(double3DK, double3DArrV);
461         double[][][] double3DArrVa = rep.getValue(double3DK);
462         assertEquals(double3DArrV.length, double3DArrVa.length);
463         for (int i = 0; i < double3DArrV.length; i++) {
464             double[][] double2DT = double3DArrV[i];
465             double[][] double2DTa = double3DArrVa[i];
466             assertEquals(double2DT.length, double2DTa.length);
467             for (int j = 0; j < double2DT.length; j++) {
468                 assertTrue(Arrays.equals(double2DT[j], double2DTa[j]));
469             }
470         }
471         double[][][] double3DArrVEmpty = {};
472         rep.setValue(double3DK, double3DArrVEmpty);
473         double[][][] double3DArrVEmptyA = rep.getValue(double3DK);
474         assertEquals(double3DArrVEmpty.length, double3DArrVEmptyA.length);
475         for (int i = 0; i < double3DArrVEmpty.length; i++) {
476             double[][] double2DT = double3DArrVEmpty[i];
477             double[][] double2DTa = double3DArrVEmptyA[i];
478             assertEquals(double2DT.length, double2DTa.length);
479             for (int j = 0; j < double2DT.length; j++) {
480                 assertTrue(Arrays.equals(double2DT[j], double2DTa[j]));
481             }
482         }
483
484         //boolean
485         String boolean3DK = "boolean3DK";
486         boolean[] booleanArrV1 = {true, false, true, true, false};
487         boolean[] booleanArrV2 = {false, false, false, true};
488         boolean[][] boolean2DArrV1 = {booleanArrV1, booleanArrV2};
489         boolean[] booleanArrV3 = {true, true};
490         boolean[] booleanArrV4 = {false};
491         boolean[][] boolean2DArrV2 = {booleanArrV3, booleanArrV4};
492         boolean[][][] boolean3DArrV = {boolean2DArrV1, boolean2DArrV2};
493         rep.setValue(boolean3DK, boolean3DArrV);
494         boolean[][][] boolean3DArrVa = rep.getValue(boolean3DK);
495         assertEquals(boolean3DArrV.length, boolean3DArrVa.length);
496         for (int i = 0; i < boolean3DArrV.length; i++) {
497             boolean[][] boolean2DT = boolean3DArrV[i];
498             boolean[][] boolean2DTa = boolean3DArrVa[i];
499             assertEquals(boolean2DT.length, boolean2DTa.length);
500             for (int j = 0; j < boolean2DT.length; j++) {
501                 assertTrue(Arrays.equals(boolean2DT[j], boolean2DTa[j]));
502             }
503         }
504         boolean[][][] boolean3DArrVEmpty = {};
505         rep.setValue(boolean3DK, boolean3DArrVEmpty);
506         boolean[][][] boolean3DArrVEmptyA = rep.getValue(boolean3DK);
507         assertEquals(boolean3DArrVEmpty.length, boolean3DArrVEmptyA.length);
508         for (int i = 0; i < boolean3DArrVEmpty.length; i++) {
509             boolean[][] boolean2DT = boolean3DArrVEmpty[i];
510             boolean[][] boolean2DTa = boolean3DArrVEmptyA[i];
511             assertEquals(boolean2DT.length, boolean2DTa.length);
512             for (int j = 0; j < boolean2DT.length; j++) {
513                 assertTrue(Arrays.equals(boolean2DT[j], boolean2DTa[j]));
514             }
515         }
516
517         //String
518         String string3DK = "string3DK";
519         String[] stringArrV1 = {"a", "bb", "ccc", "dddd", "eeee"};
520         String[] stringArrV2 = {"f", "gg", "hhh", "ii"};
521         String[][] string2DArrV1 = {stringArrV1, stringArrV2};
522         String[] stringArrV3 = {"j", "jj"};
523         String[] stringArrV4 = {"jjj"};
524         String[][] string2DArrV2 = {stringArrV3, stringArrV4};
525         String[][][] string3DArrV = {string2DArrV1, string2DArrV2};
526         rep.setValue(string3DK, string3DArrV);
527         String[][][] string3DArrVa = rep.getValue(string3DK);
528         assertEquals(string3DArrV.length, string3DArrVa.length);
529         for (int i = 0; i < string3DArrV.length; i++) {
530             String[][] string2DT = string3DArrV[i];
531             String[][] string2DTa = string3DArrVa[i];
532             assertEquals(string2DT.length, string2DTa.length);
533             for (int j = 0; j < string2DT.length; j++) {
534                 assertTrue(Arrays.equals(string2DT[j], string2DTa[j]));
535             }
536         }
537         String[][][] string3DArrVEmpty = {};
538         rep.setValue(string3DK, string3DArrVEmpty);
539         String[][][] string3DArrVEmptyA = rep.getValue(string3DK);
540         assertEquals(string3DArrVEmpty.length, string3DArrVEmptyA.length);
541         for (int i = 0; i < string3DArrVEmpty.length; i++) {
542             String[][] string2DT = string3DArrVEmpty[i];
543             String[][] string2DTa = string3DArrVEmptyA[i];
544             assertEquals(string2DT.length, string2DTa.length);
545             for (int j = 0; j < string2DT.length; j++) {
546                 assertTrue(Arrays.equals(string2DT[j], string2DTa[j]));
547             }
548         }
549
550         //OcRepresentation
551         String intK = "intK";
552         String representation3DK = "representation3DK";
553         OcRepresentation[] representation2DArrV1 = {
554                 new OcRepresentation(),
555                 new OcRepresentation(),
556                 new OcRepresentation(),
557                 new OcRepresentation()};
558         representation2DArrV1[0].setValue(intK, 0);
559         representation2DArrV1[1].setValue(intK, 1);
560         representation2DArrV1[2].setValue(intK, 2);
561         representation2DArrV1[3].setValue(intK, 3);
562
563         OcRepresentation[] representation2DArrV2 = {
564                 new OcRepresentation(),
565                 new OcRepresentation(),
566                 new OcRepresentation(),
567                 new OcRepresentation()};
568         representation2DArrV2[0].setValue(intK, 4);
569         representation2DArrV2[1].setValue(intK, 5);
570         representation2DArrV2[2].setValue(intK, 6);
571         representation2DArrV2[3].setValue(intK, 7);
572
573         OcRepresentation[][] representation2DArrV = {representation2DArrV1, representation2DArrV2};
574         OcRepresentation[][][] representation3DArrV = {representation2DArrV, representation2DArrV};
575
576         rep.setValue(representation3DK, representation3DArrV);
577         OcRepresentation[][][] representation3DArrVa = rep.getValue(representation3DK);
578         assertEquals(representation3DArrV.length, representation3DArrVa.length);
579         for (int i = 0; i < representation3DArrV.length; ++i) {
580             OcRepresentation[][] repArr2V = representation3DArrV[i];
581             OcRepresentation[][] repArr2Va = representation3DArrVa[i];
582             assertEquals(repArr2V.length, repArr2Va.length);
583             for (int j = 0; j < repArr2V.length; ++j) {
584                 OcRepresentation[] repArrV = repArr2V[j];
585                 OcRepresentation[] repArrVa = repArr2Va[j];
586                 assertEquals(repArrV.length, repArrVa.length);
587                 for (int k = 0; k < repArrV.length; ++k) {
588                     assertEquals(repArrV[k].getValue(intK), repArrVa[k].getValue(intK));
589                 }
590             }
591         }
592     }
593 }