// Path: app/src/main/java/com/newegg/tr/dagger2prac/model/config/Config.java
// public interface Config {
// 
//     public String getUserName();
// 
//     public void setUserName(String userName);
// 
// }
// 
// Path: app/src/main/java/com/newegg/tr/dagger2prac/model/config/ConfigManager.java
// public class ConfigManager implements Config {
// 
//     private final static String DEFAULT_USER = "William";
// 
//     private String mUserName = DEFAULT_USER;
// 
//     @Override
//     public String getUserName() {
//         return mUserName;
//     }
// 
//     @Override
//     public void setUserName(String userName) {
//         mUserName = userName;
//     }
// }
// 
// Path: app/src/main/java/com/newegg/tr/dagger2prac/presenter/SettingPresenter.java
// public interface SettingPresenter {
// 
//     public String getUserName();
// 
//     public void setUserName(String name);
// }
// 
// Path: app/src/main/java/com/newegg/tr/dagger2prac/presenter/internal/SettingPresenterImpl.java
// public class SettingPresenterImpl implements SettingPresenter {
// 
//     SettingView mView;
//     Config mConfig;
// 
//     @Inject
//     public SettingPresenterImpl(SettingView view, Config config){
//         mView = view;
//         mConfig = config;
//     }
// 
//     @Override
//     public String getUserName() {
//         return mConfig.getUserName();
//     }
// 
//     @Override
//     public void setUserName(String name) {
//         mConfig.setUserName(name);
//         mView.updateUserName(name);
//     }
// }
// 
// Path: app/src/main/java/com/newegg/tr/dagger2prac/view/SettingView.java
// public interface SettingView {
// 
//     public void updateUserName(String userName);
// 
// }


import com.newegg.tr.dagger2prac.model.config.Config;
import com.newegg.tr.dagger2prac.model.config.ConfigManager;
import com.newegg.tr.dagger2prac.presenter.SettingPresenter;
import com.newegg.tr.dagger2prac.presenter.internal.SettingPresenterImpl;
import com.newegg.tr.dagger2prac.view.SettingView;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides;
import static org.mockito.Mockito.when;
package com.newegg.tr.dagger2prac.view.module;






/**
 * Created by william on 15/2/13.
 */
@Module
public class TestSettingModule {


    public final static String INIT_NAME = "大中天";
    SettingView mView;
    @Mock
    Config mMockConfig;
    private boolean mIsMock;

    public TestSettingModule(SettingView view, boolean isMock) {
        mView = view;
        mIsMock = isMock;
        MockitoAnnotations.initMocks(this);
        when(mMockConfig.getUserName()).thenReturn(INIT_NAME);
    }

    @Singleton
    @Provides
    public SettingPresenter provideSettingPresenter(Config config) {
// Path: app/src/main/java/com/newegg/tr/dagger2prac/model/config/Config.java
// public interface Config {
// 
//     public String getUserName();
// 
//     public void setUserName(String userName);
// 
// }
// 
// Path: app/src/main/java/com/newegg/tr/dagger2prac/model/config/ConfigManager.java
// public class ConfigManager implements Config {
// 
//     private final static String DEFAULT_USER = "William";
// 
//     private String mUserName = DEFAULT_USER;
// 
//     @Override
//     public String getUserName() {
//         return mUserName;
//     }
// 
//     @Override
//     public void setUserName(String userName) {
//         mUserName = userName;
//     }
// }
// 
// Path: app/src/main/java/com/newegg/tr/dagger2prac/presenter/SettingPresenter.java
// public interface SettingPresenter {
// 
//     public String getUserName();
// 
//     public void setUserName(String name);
// }
// 
// Path: app/src/main/java/com/newegg/tr/dagger2prac/presenter/internal/SettingPresenterImpl.java
// public class SettingPresenterImpl implements SettingPresenter {
// 
//     SettingView mView;
//     Config mConfig;
// 
//     @Inject
//     public SettingPresenterImpl(SettingView view, Config config){
//         mView = view;
//         mConfig = config;
//     }
// 
//     @Override
//     public String getUserName() {
//         return mConfig.getUserName();
//     }
// 
//     @Override
//     public void setUserName(String name) {
//         mConfig.setUserName(name);
//         mView.updateUserName(name);
//     }
// }
// 
// Path: app/src/main/java/com/newegg/tr/dagger2prac/view/SettingView.java
// public interface SettingView {
// 
//     public void updateUserName(String userName);
// 
// }


// Path: app/src/debug/java/com/newegg/tr/dagger2prac/view/module/TestSettingModule.java
import com.newegg.tr.dagger2prac.model.config.Config;
import com.newegg.tr.dagger2prac.model.config.ConfigManager;
import com.newegg.tr.dagger2prac.presenter.SettingPresenter;
import com.newegg.tr.dagger2prac.presenter.internal.SettingPresenterImpl;
import com.newegg.tr.dagger2prac.view.SettingView;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides;
import static org.mockito.Mockito.when;

package com.newegg.tr.dagger2prac.view.module;






/**
 * Created by william on 15/2/13.
 */
@Module
public class TestSettingModule {


    public final static String INIT_NAME = "大中天";
    SettingView mView;
    @Mock
    Config mMockConfig;
    private boolean mIsMock;

    public TestSettingModule(SettingView view, boolean isMock) {
        mView = view;
        mIsMock = isMock;
        MockitoAnnotations.initMocks(this);
        when(mMockConfig.getUserName()).thenReturn(INIT_NAME);
    }

    @Singleton
    @Provides
    public SettingPresenter provideSettingPresenter(Config config) {
        return new SettingPresenterImpl(mView, config);