Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat : added unit tests to project #1

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Conversation

oyeleke
Copy link
Collaborator

@oyeleke oyeleke commented May 28, 2018

Added unit tests by mocking objects using mockito,

Copy link

@goke-epapa goke-epapa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really good work, you need to do some cleanups.

app/build.gradle Outdated
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

app/build.gradle Outdated
compile 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.google.dagger:dagger-compiler:2.10'
androidTestCompile 'com.android.support.test:runner:1.0.2'
testCompile 'org.mockito:mockito-core:2.7.22'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change testCompile to testImplementation

app/build.gradle Outdated
annotationProcessor 'com.google.dagger:dagger-compiler:2.10'
androidTestCompile 'com.android.support.test:runner:1.0.2'
testCompile 'org.mockito:mockito-core:2.7.22'
androidTestCompile 'org.mockito:mockito-android:2.7.22'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll need to change this as well, confirm what the newer keyword is.

// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();

assertEquals("com.example.oyeleke.rxjavatest", appContext.getPackageName());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Package name is not right


//test to ensure that when a null user value is changed no interaction takes place in the view
// @Test
// public void noInteractionWithView(){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove commented code

//verify model interactions
verify(mockLoginModel, times(1)).getUser();
//test fails if the model is called more than once
// verify(mockLoginModel, times(2)).getUser();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove commented line

.gitignore Outdated
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the entire .idea folder

app/build.gradle Outdated
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.oyeleke.rxjavatest"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should change the applicationID

@@ -0,0 +1,23 @@
package com.example.oyeleke.dependencyinjectionandtestdemo.login;

/**

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove header

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants