// Path: app/src/main/java/io/kaif/mobile/KaifApplication.java
// public class KaifApplication extends Application {
// 
//   private static KaifApplication INSTANCE;
// 
//   private Beans beans;
// 
//   @Override
//   public void onCreate() {
//     super.onCreate();
//     INSTANCE = this;
//     beans = Beans.Initializer.init(this);
//   }
// 
//   public static KaifApplication getInstance() {
//     return INSTANCE;
//   }
// 
//   public Beans beans() {
//     return beans;
//   }
// 
//   public void setBeans(Beans beans) {
//     this.beans = beans;
//   }
// 
// }
// 
// Path: app/src/androidTest/java/io/kaif/mobile/TestBeans.java
// @Singleton
// @Component(modules = MockDaemonModule.class)
// public interface TestBeans extends Beans {
// 
//   void inject(HomeActivityTest homeActivityTest);
// 
//   void inject(LoginActivityTest loginActivityTest);
// }
// 
// Path: app/src/main/java/io/kaif/mobile/view/daemon/AccountDaemon.java
// @Singleton
// public class AccountDaemon {
// 
//   private final EventPublishSubject<AccountEvent> subject;
// 
//   private final OauthService oauthService;
// 
//   private final AccessTokenManager accessTokenManager;
// 
//   private final ApiConfiguration apiConfiguration;
// 
//   private String state;
// 
//   @Inject
//   AccountDaemon(OauthService oauthService,
//       AccessTokenManager accessTokenManager,
//       ApiConfiguration apiConfiguration) {
//     this.oauthService = oauthService;
//     this.accessTokenManager = accessTokenManager;
//     this.apiConfiguration = apiConfiguration;
//     this.subject = new EventPublishSubject<>();
//   }
// 
//   public Observable<AccountEvent> getSubject(Class<?>... classes) {
//     return subject.getSubject(classes);
//   }
// 
//   public <T extends AccountEvent> Observable<T> getSubject(Class<T> clazz) {
//     return subject.getSubject(clazz);
//   }
// 
//   public Intent createOauthPageIntent() {
//     state = UUID.randomUUID().toString();
//     final Uri uri = Uri.parse(apiConfiguration.getEndPoint())
//         .buildUpon()
//         .appendPath("oauth")
//         .appendPath("authorize")
//         .appendQueryParameter("client_id", apiConfiguration.getClientId())
//         .appendQueryParameter("response_type", "code")
//         .appendQueryParameter("scope", "public feed article vote user debate")
//         .appendQueryParameter("state", state)
//         .appendQueryParameter("redirect_uri", apiConfiguration.getRedirectUri())
//         .build();
//     Intent intent = new Intent(Intent.ACTION_VIEW);
//     intent.setData(uri);
//     return intent;
//   }
// 
//   public boolean hasAccount() {
//     return accessTokenManager.hasAccount();
//   }
// 
//   public void signOut() {
//     accessTokenManager.signOut();
//     subject.onNext(new SignOutEvent());
//   }
// 
//   public Observable<Void> accessToken(String code, String state) {
//     if (!TextUtils.equals(this.state, state)) {
//       return Observable.<Void>error(new IllegalStateException("receive a malicious response"));
//     }
//     this.state = null;
//     return oauthService.getAccessToken(apiConfiguration.getClientId(),
//         apiConfiguration.getClientSecret(),
//         code,
//         apiConfiguration.getRedirectUri(),
//         "authorization_code").<Void>map(accessTokenInfo -> {
//       accessTokenManager.saveAccount(accessTokenInfo);
//       subject.onNext(new SignInSuccessEvent());
//       return null;
//     });
//   }
// }


import android.app.Instrumentation;
import android.content.Intent;
import android.net.Uri;
import android.support.test.InstrumentationRegistry;
import android.support.test.espresso.intent.Intents;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import javax.inject.Inject;
import io.kaif.mobile.DaggerTestBeans;
import io.kaif.mobile.KaifApplication;
import io.kaif.mobile.R;
import io.kaif.mobile.TestBeans;
import io.kaif.mobile.view.daemon.AccountDaemon;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.intent.Intents.intended;
import static android.support.test.espresso.intent.matcher.IntentMatchers.hasAction;
import static android.support.test.espresso.intent.matcher.IntentMatchers.hasData;
import static android.support.test.espresso.intent.matcher.UriMatchers.hasHost;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.equalTo;
package io.kaif.mobile.view;






@RunWith(AndroidJUnit4.class)
public class LoginActivityTest {

// Path: app/src/main/java/io/kaif/mobile/KaifApplication.java
// public class KaifApplication extends Application {
// 
//   private static KaifApplication INSTANCE;
// 
//   private Beans beans;
// 
//   @Override
//   public void onCreate() {
//     super.onCreate();
//     INSTANCE = this;
//     beans = Beans.Initializer.init(this);
//   }
// 
//   public static KaifApplication getInstance() {
//     return INSTANCE;
//   }
// 
//   public Beans beans() {
//     return beans;
//   }
// 
//   public void setBeans(Beans beans) {
//     this.beans = beans;
//   }
// 
// }
// 
// Path: app/src/androidTest/java/io/kaif/mobile/TestBeans.java
// @Singleton
// @Component(modules = MockDaemonModule.class)
// public interface TestBeans extends Beans {
// 
//   void inject(HomeActivityTest homeActivityTest);
// 
//   void inject(LoginActivityTest loginActivityTest);
// }
// 
// Path: app/src/main/java/io/kaif/mobile/view/daemon/AccountDaemon.java
// @Singleton
// public class AccountDaemon {
// 
//   private final EventPublishSubject<AccountEvent> subject;
// 
//   private final OauthService oauthService;
// 
//   private final AccessTokenManager accessTokenManager;
// 
//   private final ApiConfiguration apiConfiguration;
// 
//   private String state;
// 
//   @Inject
//   AccountDaemon(OauthService oauthService,
//       AccessTokenManager accessTokenManager,
//       ApiConfiguration apiConfiguration) {
//     this.oauthService = oauthService;
//     this.accessTokenManager = accessTokenManager;
//     this.apiConfiguration = apiConfiguration;
//     this.subject = new EventPublishSubject<>();
//   }
// 
//   public Observable<AccountEvent> getSubject(Class<?>... classes) {
//     return subject.getSubject(classes);
//   }
// 
//   public <T extends AccountEvent> Observable<T> getSubject(Class<T> clazz) {
//     return subject.getSubject(clazz);
//   }
// 
//   public Intent createOauthPageIntent() {
//     state = UUID.randomUUID().toString();
//     final Uri uri = Uri.parse(apiConfiguration.getEndPoint())
//         .buildUpon()
//         .appendPath("oauth")
//         .appendPath("authorize")
//         .appendQueryParameter("client_id", apiConfiguration.getClientId())
//         .appendQueryParameter("response_type", "code")
//         .appendQueryParameter("scope", "public feed article vote user debate")
//         .appendQueryParameter("state", state)
//         .appendQueryParameter("redirect_uri", apiConfiguration.getRedirectUri())
//         .build();
//     Intent intent = new Intent(Intent.ACTION_VIEW);
//     intent.setData(uri);
//     return intent;
//   }
// 
//   public boolean hasAccount() {
//     return accessTokenManager.hasAccount();
//   }
// 
//   public void signOut() {
//     accessTokenManager.signOut();
//     subject.onNext(new SignOutEvent());
//   }
// 
//   public Observable<Void> accessToken(String code, String state) {
//     if (!TextUtils.equals(this.state, state)) {
//       return Observable.<Void>error(new IllegalStateException("receive a malicious response"));
//     }
//     this.state = null;
//     return oauthService.getAccessToken(apiConfiguration.getClientId(),
//         apiConfiguration.getClientSecret(),
//         code,
//         apiConfiguration.getRedirectUri(),
//         "authorization_code").<Void>map(accessTokenInfo -> {
//       accessTokenManager.saveAccount(accessTokenInfo);
//       subject.onNext(new SignInSuccessEvent());
//       return null;
//     });
//   }
// }


// Path: app/src/androidTest/java/io/kaif/mobile/view/LoginActivityTest.java
import android.app.Instrumentation;
import android.content.Intent;
import android.net.Uri;
import android.support.test.InstrumentationRegistry;
import android.support.test.espresso.intent.Intents;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import javax.inject.Inject;
import io.kaif.mobile.DaggerTestBeans;
import io.kaif.mobile.KaifApplication;
import io.kaif.mobile.R;
import io.kaif.mobile.TestBeans;
import io.kaif.mobile.view.daemon.AccountDaemon;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.intent.Intents.intended;
import static android.support.test.espresso.intent.matcher.IntentMatchers.hasAction;
import static android.support.test.espresso.intent.matcher.IntentMatchers.hasData;
import static android.support.test.espresso.intent.matcher.UriMatchers.hasHost;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.equalTo;

package io.kaif.mobile.view;






@RunWith(AndroidJUnit4.class)
public class LoginActivityTest {

  @Inject