2 * Copyright (c) 2018 Red Hat, 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.util;
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertThrows;
13 import org.junit.Test;
14 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
16 public class DatastoreTest {
18 public void testDatastoreToType() {
19 assertEquals(LogicalDatastoreType.CONFIGURATION, Datastore.CONFIGURATION.type());
20 assertEquals(LogicalDatastoreType.OPERATIONAL, Datastore.OPERATIONAL.type());
24 public void testDatastoreToClass() {
25 assertEquals(Datastore.CONFIGURATION, Datastore.ofType(LogicalDatastoreType.CONFIGURATION));
26 assertEquals(Datastore.OPERATIONAL, Datastore.ofType(LogicalDatastoreType.OPERATIONAL));
27 assertThrows(NullPointerException.class, () -> Datastore.ofType(null));