2 * Copyright (c) 2018 Pantheon Technologies, s.r.o. 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.spec.util;
9 import static org.junit.Assert.assertSame;
10 import static org.opendaylight.mdsal.binding.spec.util.DataObjectUtils.nullToEmpty;
12 import com.google.common.collect.ImmutableList;
13 import java.util.Collections;
14 import java.util.List;
15 import org.junit.Test;
17 public class DataObjectUtilsTest {
19 public void nullToEmptyNullTest() {
20 assertSame(ImmutableList.of(), nullToEmpty(null));
24 public void nullToEmptyNonNullTest() {
25 final List<Object> list = Collections.singletonList(null);
26 assertSame(list, nullToEmpty(list));