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.genius.infra.tests;
10 import static com.google.common.truth.Truth.assertThat;
12 import org.junit.Test;
13 import org.opendaylight.genius.infra.Datastore;
14 import org.opendaylight.infrautils.testutils.Asserts;
15 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
17 public class DatastoreTest {
20 public void testDatastore() {
21 assertThat(Datastore.toType(Datastore.CONFIGURATION)).isEqualTo(LogicalDatastoreType.CONFIGURATION);
22 assertThat(Datastore.toType(Datastore.OPERATIONAL)).isEqualTo(LogicalDatastoreType.OPERATIONAL);
23 Asserts.assertThrows(NullPointerException.class, () -> Datastore.toType(null));
25 assertThat(Datastore.toClass(LogicalDatastoreType.CONFIGURATION)).isEqualTo(Datastore.CONFIGURATION);
26 assertThat(Datastore.toClass(LogicalDatastoreType.OPERATIONAL)).isEqualTo(Datastore.OPERATIONAL);
27 Asserts.assertThrows(NullPointerException.class, () -> Datastore.toClass(null));