Implement managed transactions
[mdsal.git] / binding / mdsal-binding-util / src / test / java / org / opendaylight / mdsal / binding / util / DatastoreTest.java
1 /*
2  * Copyright (c) 2018 Red Hat, Inc. and others. 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.util;
9
10 import static com.google.common.truth.Truth.assertThat;
11
12 import org.junit.Assert;
13 import org.junit.Test;
14 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
15
16 public class DatastoreTest {
17
18     @Test
19     public void testDatastore() {
20         assertThat(Datastore.toType(Datastore.CONFIGURATION)).isEqualTo(LogicalDatastoreType.CONFIGURATION);
21         assertThat(Datastore.toType(Datastore.OPERATIONAL)).isEqualTo(LogicalDatastoreType.OPERATIONAL);
22         try {
23             Datastore.toType(null);
24             Assert.fail("Expected Datastore.toType(null) to throw NullPointerException");
25         } catch (NullPointerException e) {
26             // OK, this is what we're expecting
27         }
28
29         assertThat(Datastore.toClass(LogicalDatastoreType.CONFIGURATION)).isEqualTo(Datastore.CONFIGURATION);
30         assertThat(Datastore.toClass(LogicalDatastoreType.OPERATIONAL)).isEqualTo(Datastore.OPERATIONAL);
31         try {
32             Datastore.toClass(null);
33             Assert.fail("Expected Datastore.toClass(null) to throw NullPointerException");
34         } catch (NullPointerException e) {
35             // OK, this is what we're expecting
36         }
37     }
38
39 }