/*
 * Copyright 2016 Andrey Tolpeev
 *
 * 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 com.github.vase4kin.teamcityapp.home.extractor;

import android.os.Bundle;

import com.github.vase4kin.teamcityapp.base.extractor.BundleExtractorValues;

import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;

import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

public class RootValueExtractorImplTest {

    @Mock
    private Bundle mBundle;

    private HomeBundleValueManagerImpl mValueExtractor;

    @Before
    public void setUp() {
        MockitoAnnotations.initMocks(this);
        mValueExtractor = new HomeBundleValueManagerImpl(mBundle);
    }

    @Test
    public void testIsRequiredToReloadIfBundleIsNull() throws Exception {
        mValueExtractor = new HomeBundleValueManagerImpl(null);
        assertThat(mValueExtractor.isRequiredToReload(), is(equalTo(false)));
    }

    @Test
    public void testIsRequiredToReloadIfBundleIsNotNull() throws Exception {
        mValueExtractor = new HomeBundleValueManagerImpl(mBundle);
        when(mBundle.getBoolean(BundleExtractorValues.IS_REQUIRED_TO_RELOAD, false)).thenReturn(true);
        assertThat(mValueExtractor.isRequiredToReload(), is(equalTo(true)));
    }

    @Test
    public void testIsNewAccountCreatedIfBundleIsNull() throws Exception {
        mValueExtractor = new HomeBundleValueManagerImpl(null);
        assertThat(mValueExtractor.isNewAccountCreated(), is(equalTo(false)));
    }

    @Test
    public void testIsNewAccountCreatedIfBundleIsNotNull() throws Exception {
        mValueExtractor = new HomeBundleValueManagerImpl(mBundle);
        when(mBundle.getBoolean(BundleExtractorValues.IS_NEW_ACCOUNT_CREATED, false)).thenReturn(true);
        assertThat(mValueExtractor.isNewAccountCreated(), is(equalTo(true)));
    }

    @Test
    public void testClear() throws Exception {
        mValueExtractor.clear();
        verify(mBundle).clear();
    }
}
@@ -683,86 +683,8 @@
 e;%0A%0A
-import com.github.vase4kin.teamcityapp.base.extractor.BundleExtractorValues;%0A%0A
 impo
@@ -796,139 +796,8 @@
 s;%0A%0A
-import static org.hamcrest.core.Is.is;%0Aimport static org.hamcrest.core.IsEqual.equalTo;%0Aimport static org.junit.Assert.assertThat;%0A
 impo
@@ -837,48 +837,8 @@
 ify;
-%0Aimport static org.mockito.Mockito.when;
 %0A%0Apu
@@ -1134,1161 +1134,8 @@
  %7D%0A%0A
-    @Test%0A    public void testIsRequiredToReloadIfBundleIsNull() throws Exception %7B%0A        mValueExtractor = new HomeBundleValueManagerImpl(null);%0A        assertThat(mValueExtractor.isRequiredToReload(), is(equalTo(false)));%0A    %7D%0A%0A    @Test%0A    public void testIsRequiredToReloadIfBundleIsNotNull() throws Exception %7B%0A        mValueExtractor = new HomeBundleValueManagerImpl(mBundle);%0A        when(mBundle.getBoolean(BundleExtractorValues.IS_REQUIRED_TO_RELOAD, false)).thenReturn(true);%0A        assertThat(mValueExtractor.isRequiredToReload(), is(equalTo(true)));%0A    %7D%0A%0A    @Test%0A    public void testIsNewAccountCreatedIfBundleIsNull() throws Exception %7B%0A        mValueExtractor = new HomeBundleValueManagerImpl(null);%0A        assertThat(mValueExtractor.isNewAccountCreated(), is(equalTo(false)));%0A    %7D%0A%0A    @Test%0A    public void testIsNewAccountCreatedIfBundleIsNotNull() throws Exception %7B%0A        mValueExtractor = new HomeBundleValueManagerImpl(mBundle);%0A        when(mBundle.getBoolean(BundleExtractorValues.IS_NEW_ACCOUNT_CREATED, false)).thenReturn(true);%0A        assertThat(mValueExtractor.isNewAccountCreated(), is(equalTo(true)));%0A    %7D%0A%0A
     

Delete redundant tests