// Path: app/src/main/java/com/newegg/tr/dagger2prac/model/action/Action.java
// public interface Action {
// 
//     public String hello();
// 
//     public String bye();
// 
//     public String fibonacci();
// 
//     public int calcFibNumber(int input);
// }
// 
// Path: app/src/main/java/com/newegg/tr/dagger2prac/model/action/ActionModel.java
// public class ActionModel implements Action {
// 
//     private final Messenger mMessenger;
// 
//     private final Config mConfig;
// 
//     @Inject
//     public ActionModel(Messenger messenger, Config config) {
// 
//         mMessenger = messenger;
// 
//         mConfig = config;
//     }
// 
//     @Override
//     public String hello() {
// 
//         return String.format(mMessenger.getHelloFormat(), mConfig.getUserName());
//     }
// 
//     @Override
//     public String bye() {
// 
//         return String.format(mMessenger.getByeFormat(), mConfig.getUserName());
//     }
// 
//     @Override
//     public String fibonacci() {
// 
//         return mMessenger.getFibInitMessage();
// 
//     }
// 
//     @Override
//     public int calcFibNumber(int input) {
// 
//         if(input <=0 )
//             return -1;
// 
//         return fibMethod(input);
//     }
// 
//     private int fibMethod(int n){
//         if(n <= 0)
//             throw new IllegalArgumentException("Input must be positive integer");
//         if(n == 1)
//             return 1;
//         if(n == 2)
//             return 1;
//         return fibMethod(n-2) + fibMethod(n-1);
//     }
// 
// 
// }
// 
// 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/message/Messenger.java
// public interface Messenger {
// 
//     public String getHelloFormat();
// 
//     public String getByeFormat();
// 
//     public String getFibInitMessage();
// 
//     public String getCalcText();
// }


import com.newegg.tr.dagger2prac.model.action.Action;
import com.newegg.tr.dagger2prac.model.action.ActionModel;
import com.newegg.tr.dagger2prac.model.config.Config;
import com.newegg.tr.dagger2prac.model.message.Messenger;
import junit.framework.TestCase;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
package com.newegg.tr.dagger2prac.model;





/**
 * Created by william on 15/2/2.
 */

public class ActionModelTest extends TestCase {

    @Mock
    private Action action;
    @Mock
    private Messenger mMessenger;
    @Mock
    private Config mConfig;

    @Override
    protected void setUp() throws Exception {
        super.setUp();
        MockitoAnnotations.initMocks(this);
    }

    public void testHello() {
        String stubPerson = "Who is not important in this case.";
        String stubMessage = "Test Hello in stub with %s";
        String exceptResult = "Test Hello in stub with Who is not important in this case.";

        when(mMessenger.getHelloFormat()).thenReturn(stubMessage);

        when(mConfig.getUserName()).thenReturn(stubPerson);

        action = new ActionModel(mMessenger, mConfig);

        assertEquals(exceptResult, action.hello());

        verify(mConfig, times(1)).getUserName();

    }

    public void testCalcFib() {
// Path: app/src/main/java/com/newegg/tr/dagger2prac/model/action/Action.java
// public interface Action {
// 
//     public String hello();
// 
//     public String bye();
// 
//     public String fibonacci();
// 
//     public int calcFibNumber(int input);
// }
// 
// Path: app/src/main/java/com/newegg/tr/dagger2prac/model/action/ActionModel.java
// public class ActionModel implements Action {
// 
//     private final Messenger mMessenger;
// 
//     private final Config mConfig;
// 
//     @Inject
//     public ActionModel(Messenger messenger, Config config) {
// 
//         mMessenger = messenger;
// 
//         mConfig = config;
//     }
// 
//     @Override
//     public String hello() {
// 
//         return String.format(mMessenger.getHelloFormat(), mConfig.getUserName());
//     }
// 
//     @Override
//     public String bye() {
// 
//         return String.format(mMessenger.getByeFormat(), mConfig.getUserName());
//     }
// 
//     @Override
//     public String fibonacci() {
// 
//         return mMessenger.getFibInitMessage();
// 
//     }
// 
//     @Override
//     public int calcFibNumber(int input) {
// 
//         if(input <=0 )
//             return -1;
// 
//         return fibMethod(input);
//     }
// 
//     private int fibMethod(int n){
//         if(n <= 0)
//             throw new IllegalArgumentException("Input must be positive integer");
//         if(n == 1)
//             return 1;
//         if(n == 2)
//             return 1;
//         return fibMethod(n-2) + fibMethod(n-1);
//     }
// 
// 
// }
// 
// 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/message/Messenger.java
// public interface Messenger {
// 
//     public String getHelloFormat();
// 
//     public String getByeFormat();
// 
//     public String getFibInitMessage();
// 
//     public String getCalcText();
// }


// Path: app/src/androidTest/java/com/newegg/tr/dagger2prac/model/ActionModelTest.java
import com.newegg.tr.dagger2prac.model.action.Action;
import com.newegg.tr.dagger2prac.model.action.ActionModel;
import com.newegg.tr.dagger2prac.model.config.Config;
import com.newegg.tr.dagger2prac.model.message.Messenger;
import junit.framework.TestCase;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

package com.newegg.tr.dagger2prac.model;





/**
 * Created by william on 15/2/2.
 */

public class ActionModelTest extends TestCase {

    @Mock
    private Action action;
    @Mock
    private Messenger mMessenger;
    @Mock
    private Config mConfig;

    @Override
    protected void setUp() throws Exception {
        super.setUp();
        MockitoAnnotations.initMocks(this);
    }

    public void testHello() {
        String stubPerson = "Who is not important in this case.";
        String stubMessage = "Test Hello in stub with %s";
        String exceptResult = "Test Hello in stub with Who is not important in this case.";

        when(mMessenger.getHelloFormat()).thenReturn(stubMessage);

        when(mConfig.getUserName()).thenReturn(stubPerson);

        action = new ActionModel(mMessenger, mConfig);

        assertEquals(exceptResult, action.hello());

        verify(mConfig, times(1)).getUserName();

    }

    public void testCalcFib() {
        action = new ActionModel(mock(Messenger.class), mock(Config.class));