2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.mdsal.binding.dom.codec.impl;
10 import static org.junit.Assert.assertNotNull;
12 import java.util.Collections;
13 import org.junit.Test;
14 import org.opendaylight.yang.gen.v1.urn.yang.foo.rev160101.BooleanContainer;
15 import org.opendaylight.yang.gen.v1.urn.yang.foo.rev160101.BooleanContainerBuilder;
16 import org.opendaylight.yang.gen.v1.urn.yang.foo.rev160101._boolean.container.BooleanListBuilder;
17 import org.opendaylight.yang.gen.v1.urn.yang.foo.rev160101._boolean.container.BooleanListIntBuilder;
18 import org.opendaylight.yang.gen.v1.urn.yang.foo.rev160101._boolean.container.BooleanListIntKey;
19 import org.opendaylight.yang.gen.v1.urn.yang.foo.rev160101._boolean.container.BooleanListKey;
20 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
22 public class Bug5845booleanKeyTest extends AbstractBindingCodecTest {
24 public void testBug5845() throws Exception {
25 final BooleanListKey blk = new BooleanListKey(true, true);
26 final BooleanContainer booleanContainer = new BooleanContainerBuilder()
27 .setBooleanList(Collections.singletonMap(blk, new BooleanListBuilder()
29 .setBooleanLeaf1(true)
30 .setBooleanLeaf2(true)
34 final BooleanListIntKey blik = new BooleanListIntKey((byte) 1);
35 final BooleanContainer booleanContainerInt = new BooleanContainerBuilder()
36 .setBooleanListInt(Collections.singletonMap(blik, new BooleanListIntBuilder()
38 .setBooleanLeafInt((byte) 1)
42 final var subtreeCodec = codecContext.getDataObjectCodec(InstanceIdentifier.create(BooleanContainer.class));
43 final var serializedInt = subtreeCodec.serialize(booleanContainerInt);
44 assertNotNull(serializedInt);
45 final var serialized = subtreeCodec.serialize(booleanContainer);
46 assertNotNull(serialized);