// Path: app/src/androidTest/java/com/jachness/blockcalls/AndroidTest.java
// public abstract class AndroidTest {
//     private Context targetContext;
//     private AllComponentTest component;
//     private AppPreferences appPreferences;
//     private Context context;
// 
//     protected void setUp() throws Exception {
//         targetContext = InstrumentationRegistry.getTargetContext();
//         context = InstrumentationRegistry.getContext();
//         component = DaggerAllComponentTest.builder().blockModule(new BlockModule(targetContext))
//                 .appModule(new AppModule(targetContext))
//                 .dAOModule(new DAOModule(targetContext)).build();
//         appPreferences = new AppPreferences(targetContext);
//     }
// 
//     protected Context getTargetContext() {
//         return targetContext;
//     }
// 
//     protected AllComponentTest getComponent() {
//         return component;
//     }
// 
//     protected AppPreferences getAppPreferences() {
//         return appPreferences;
//     }
// 
//     public Context getContext() {
//         return context;
//     }
// }
// 
// Path: app/src/main/java/com/jachness/blockcalls/exceptions/FileException.java
// @SuppressWarnings("SameParameterValue")
// public class FileException extends Exception {
//     public static final int MEDIA_ERROR = 0;
//     public static final int READ_FILE_ERROR = 1;
//     public static final int WRITE_FILE_ERROR = 2;
//     private final int errorCode;
// 
//     public FileException(int errorCode) {
//         this.errorCode = errorCode;
//     }
// 
//     public FileException(int errorCode, String message) {
//         super(message);
//         this.errorCode = errorCode;
//     }
// 
//     public FileException(int errorCode, String message, Throwable cause) {
//         super(message, cause);
//         this.errorCode = errorCode;
//     }
// 
//     public int getErrorCode() {
//         return errorCode;
//     }
// }


import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import android.support.test.runner.AndroidJUnit4;
import com.jachness.blockcalls.AndroidTest;
import com.jachness.blockcalls.exceptions.FileException;
import junit.framework.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Matchers;
/*
 * Copyright (C) 2017 Jonatan Cheiro Anriquez
 *
 * This file is part of Block Calls.
 *
 * Block Calls is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Block Calls is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Block Calls. If not, see <http://www.gnu.org/licenses/>.
 */

package com.jachness.blockcalls.services;







/**
 * Created by jachness on 13/11/2016.
 */
@RunWith(AndroidJUnit4.class)
public class ImportExportWrapperTest extends AndroidTest {

    @Before
    public void setUp() throws Exception {
        super.setUp();
    }

    @Test
    public void importBlackListTest() {
        BlackListWrapper blackListWrapper = mock(BlackListWrapper.class);
        when(blackListWrapper.addNumberToBlackList(Matchers.any(String.class), Matchers.any
                (String.class), Matchers.any(Boolean.class))).thenReturn(1);

        ImportExportWrapper wrapper = new ImportExportWrapper(getTargetContext(), blackListWrapper);
        try {
            wrapper.importBlackList(null);
            Assert.fail("Should have had throw FileException exception");
// Path: app/src/androidTest/java/com/jachness/blockcalls/AndroidTest.java
// public abstract class AndroidTest {
//     private Context targetContext;
//     private AllComponentTest component;
//     private AppPreferences appPreferences;
//     private Context context;
// 
//     protected void setUp() throws Exception {
//         targetContext = InstrumentationRegistry.getTargetContext();
//         context = InstrumentationRegistry.getContext();
//         component = DaggerAllComponentTest.builder().blockModule(new BlockModule(targetContext))
//                 .appModule(new AppModule(targetContext))
//                 .dAOModule(new DAOModule(targetContext)).build();
//         appPreferences = new AppPreferences(targetContext);
//     }
// 
//     protected Context getTargetContext() {
//         return targetContext;
//     }
// 
//     protected AllComponentTest getComponent() {
//         return component;
//     }
// 
//     protected AppPreferences getAppPreferences() {
//         return appPreferences;
//     }
// 
//     public Context getContext() {
//         return context;
//     }
// }
// 
// Path: app/src/main/java/com/jachness/blockcalls/exceptions/FileException.java
// @SuppressWarnings("SameParameterValue")
// public class FileException extends Exception {
//     public static final int MEDIA_ERROR = 0;
//     public static final int READ_FILE_ERROR = 1;
//     public static final int WRITE_FILE_ERROR = 2;
//     private final int errorCode;
// 
//     public FileException(int errorCode) {
//         this.errorCode = errorCode;
//     }
// 
//     public FileException(int errorCode, String message) {
//         super(message);
//         this.errorCode = errorCode;
//     }
// 
//     public FileException(int errorCode, String message, Throwable cause) {
//         super(message, cause);
//         this.errorCode = errorCode;
//     }
// 
//     public int getErrorCode() {
//         return errorCode;
//     }
// }


// Path: app/src/androidTest/java/com/jachness/blockcalls/services/ImportExportWrapperTest.java
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import android.support.test.runner.AndroidJUnit4;
import com.jachness.blockcalls.AndroidTest;
import com.jachness.blockcalls.exceptions.FileException;
import junit.framework.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Matchers;

/*
 * Copyright (C) 2017 Jonatan Cheiro Anriquez
 *
 * This file is part of Block Calls.
 *
 * Block Calls is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Block Calls is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Block Calls. If not, see <http://www.gnu.org/licenses/>.
 */

package com.jachness.blockcalls.services;







/**
 * Created by jachness on 13/11/2016.
 */
@RunWith(AndroidJUnit4.class)
public class ImportExportWrapperTest extends AndroidTest {

    @Before
    public void setUp() throws Exception {
        super.setUp();
    }

    @Test
    public void importBlackListTest() {
        BlackListWrapper blackListWrapper = mock(BlackListWrapper.class);
        when(blackListWrapper.addNumberToBlackList(Matchers.any(String.class), Matchers.any
                (String.class), Matchers.any(Boolean.class))).thenReturn(1);

        ImportExportWrapper wrapper = new ImportExportWrapper(getTargetContext(), blackListWrapper);
        try {
            wrapper.importBlackList(null);
            Assert.fail("Should have had throw FileException exception");
        } catch (FileException e) {