2 * Copyright (c) 2021 PANTHEON.tech, s.r.o. 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.test.model;
10 import static org.junit.Assert.assertNotNull;
11 import static org.junit.Assert.assertThrows;
13 import org.junit.Test;
14 import org.opendaylight.yang.gen.v1.mdsal661.norev.Foo;
16 public class Mdsal661Test {
18 public void testLengthEnforcerReject() {
19 assertThrows(IllegalArgumentException.class, () -> new Foo(""));
20 assertThrows(IllegalArgumentException.class, () -> new Foo("ab"));
24 public void testLengthEnforcerAccept() {
25 assertNotNull(new Foo("a"));
26 // U+1F31E, encodes to UTF-16 as "\uD83C\uDF1E", i.e. two code units
27 assertNotNull(new Foo("🌞"));