android-training-2017 icon indicating copy to clipboard operation
android-training-2017 copied to clipboard

HW #2

Open VasiliZ opened this issue 7 years ago • 16 comments

https://github.com/VasiliZ/WheelsRocket Please check tests. I correctly understood the idea of unit tests?

VasiliZ avatar Oct 11 '17 17:10 VasiliZ

AuthService authorize you are completely wrong use asynctask. Please read about it if you would like use it in homework

ilya-shknaj avatar Oct 18 '17 18:10 ilya-shknaj

AuthServiceTest nothing checked

ilya-shknaj avatar Oct 18 '17 18:10 ilya-shknaj

It's good that you know about aar, but I can't review all your code because of that. in UserAuthPresenterTest you mock and spy UserAuthPresenter and just call methods. So as result you check nothing

I don't see that you try to use robolectric

ilya-shknaj avatar Oct 18 '17 19:10 ilya-shknaj

any updates?

ilya-shknaj avatar Oct 22 '17 18:10 ilya-shknaj

@ilya-shknaj Sorry, i have a problem with tests. Method that triggers the progress bar, falls from NullPointer. I did not decide how to defeat him. https://github.com/VasiliZ/RocketWheels/compare/c8d673509778bab5446a1d41a0bfe720a9905c14...808222e1c9747c8462c0835b7a3d42667f75ff33 Refactor AsynkTask, add Robolectric test for activity, add some test. Can you help me with methods call to progress bar? In this case, why the whole problem.

VasiliZ avatar Oct 30 '17 14:10 VasiliZ

@VasiliZ I can't compile your project and tests because of you don't commit all important files.

Error:Execution failed for task ':app:processDebugGoogleServices'.

File google-services.json is missing. The Google Services Plugin cannot function without it. Searched Location: /Users/ilya_shknai/workspace_android/training/RocketWheels/app/src/debug/google-services.json /Users/ilya_shknai/workspace_android/training/RocketWheels/app/google-services.json

ilya-shknaj avatar Oct 30 '17 21:10 ilya-shknaj

gitignore not contain filter for *.iml files

ilya-shknaj avatar Oct 30 '17 22:10 ilya-shknaj

@ilya-shknaj Can you check again? https://github.com/VasiliZ/RocketWheels/compare/808222e1c9747c8462c0835b7a3d42667f75ff33...dev

VasiliZ avatar Oct 31 '17 06:10 VasiliZ

@VasiliZ project not compiling Information:Gradle tasks [:app:assembleDebug] /Users/ilya_shknai/workspace_android/training/RocketWheels/app/src/main/java/com/github/vasiliz/rocketswheel/backend/BackendSample.java Error:(29, 36) error: cannot find symbol class User /Users/ilya_shknai/workspace_android/training/RocketWheels/app/src/main/java/com/github/vasiliz/rocketswheel/userAuth/view/WebForLoginActivity.java Error:(35, 32) error: cannot find symbol variable web_view_for_login Error:(42, 37) error: cannot find symbol variable wv_for_login Error:Execution failed for task ':app:compileDebugJavaWithJavac'.

Compilation failed; see the compiler error output for details.

ilya-shknaj avatar Oct 31 '17 09:10 ilya-shknaj

@ilya-shknaj Sorry, should work

VasiliZ avatar Oct 31 '17 10:10 VasiliZ

if you completely remove your project, fetch it from git and run, it still compiling ?

ilya-shknaj avatar Oct 31 '17 10:10 ilya-shknaj

@ilya-shknaj, I clone remote project to new folder with soursethree, build and run on emulator. I did't have errors.

VasiliZ avatar Oct 31 '17 11:10 VasiliZ

after commit https://github.com/VasiliZ/RocketWheels/commit/cba5079c535543449cea03c2e7421a2e526ad147 project compiling.

What question?

LoginActivityTest not compiling because set_login_view not exists I don't catch NullPointer in application. Please attach crash log and steps how to reproduce it. If it happend in tests, please give me test class name

ilya-shknaj avatar Nov 01 '17 10:11 ilya-shknaj

@ilya-shknaj If uncomment line #31 in WebViewPresenter and run TestWebViewPresenter again. I can see in log this exeption java.lang.NullPointerException at com.github.vasiliz.rocketswheel.userAuth.presenter.WebViewPresenter.parseUrl(WebViewPresenter.java:31) at com.github.vasiliz.rocketswheel.TestWebViewPresenter.testParseUrl(TestWebViewPresenter.java:35)

VasiliZ avatar Nov 01 '17 11:11 VasiliZ

NullPointer mean that object is null and you try to do something with it. In your case call showProgress.

In your case you should set mocked 'WebClientView' into 'WebViewPresenter', but if you do it, you will have java.lang.ClassCastException: com.github.vasiliz.rocketswheel.userAuth.view.WebClientView$MockitoMock$946116891 cannot be cast to com.github.vasiliz.rocketswheel.userAuth.view.WebForLoginActivity exception

It happen because in 'attachView' method you have 'WebClientView' param and cast it to 'WebForLoginActivity' what is wrong, and thats why test will fail.

Solution WebClientView should have 'showProgress' method

ilya-shknaj avatar Nov 01 '17 16:11 ilya-shknaj

@ilya-shknaj, Could you recheck? This correct way? https://github.com/VasiliZ/RocketWheels/compare/06281797a508efca23741e9865f76a5e719d0249...dev

VasiliZ avatar Nov 01 '17 16:11 VasiliZ