co.cask.tephra.util.AbstractConfigurationProviderTest.java Source code

Java tutorial

Introduction

Here is the source code for co.cask.tephra.util.AbstractConfigurationProviderTest.java

Source

/*
 * Copyright  2015 Cask Data, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

package co.cask.tephra.util;

import org.apache.hadoop.conf.Configuration;
import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

/**
 *
 */
public abstract class AbstractConfigurationProviderTest {
    @Test
    public void testVersionFactory() {
        HBaseVersion.Version foundVersion = HBaseVersion.get();
        assertEquals(getExpectedVersion(), foundVersion);
    }

    protected abstract HBaseVersion.Version getExpectedVersion();

    @Test
    public void testConfigurationProvider() {
        Configuration conf = new Configuration();
        conf.set("foo", "bar");
        Configuration newConf = new ConfigurationFactory().get(conf);
        assertNotNull(newConf);
        assertEquals("bar", newConf.get("foo"));
    }
}