b32311504de00fc1acc5881b37f31926d6a33818
[mdsal.git] /
1 /*
2  * Copyright (c) 2018 Pantheon Technologies, s.r.o.  All rights reserved.
3  *
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
7  */
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;
11
12 import com.google.common.collect.ImmutableList;
13 import java.util.Collections;
14 import java.util.List;
15 import org.junit.Test;
16
17 public class DataObjectUtilsTest {
18     @Test
19     public void nullToEmptyNullTest() {
20         assertSame(ImmutableList.of(), nullToEmpty(null));
21     }
22
23     @Test
24     public void nullToEmptyNonNullTest() {
25         final List<Object> list = Collections.singletonList(null);
26         assertSame(list, nullToEmpty(list));
27     }
28 }