kotlin season 1 - Part 20 Presenter Test

7589a5a8fec022e8af4e46525150a291?s=47 TaeHwan
November 24, 2016

kotlin season 1 - Part 20 Presenter Test

2016년 유데미 Kotlin 강의를 공개합니다.

동영상 : https://www.youtube.com/watch?v=-YM-PKDE114

2회 분은 유데미에서 확인 가능합니다.
http://bit.ly/2UpaJUR

7589a5a8fec022e8af4e46525150a291?s=128

TaeHwan

November 24, 2016
Tweet

Transcript

  1. Part 20 Kotlin Presenter Test Taehwan ରࣁ؀ উ٘۽੉٘ ѐߊ ঱য

    ௏ౣܽ, द੘ೞӝ thdev.tech, 2016 1
  2. ࢠ೒ ௏٘ח!!! 4 Sample Code GitHub ࠳۠஖ : 13-Presenter-Test 4

    https://github.com/taehwandev/Kotlin-Udemy- Sample/tree/13-Presetner-Test ରࣁ؀ উ٘۽੉٘ ѐߊ ঱য ௏ౣܽ, द੘ೞӝ thdev.tech, 2016 2
  3. য়ט਷ 4 Mockito ࣗѐ 4 Presenter పझ౟ ௏٘ ੘ࢿ ରࣁ؀

    উ٘۽੉٘ ѐߊ ঱য ௏ౣܽ, द੘ೞӝ thdev.tech, 2016 3
  4. Mockito 4 Tasty mocking framework for unit tests in Java

    ରࣁ؀ উ٘۽੉٘ ѐߊ ঱য ௏ౣܽ, द੘ೞӝ thdev.tech, 2016 4
  5. Mockitoਸ ࢎਊೞӝ ਤ೧ࢲ repositories { jcenter() } dependencies { testCompile

    "org.mockito:mockito-core:2.2.21" } ରࣁ؀ উ٘۽੉٘ ѐߊ ঱য ௏ౣܽ, द੘ೞӝ thdev.tech, 2016 5
  6. Mockito - verify import static org.mockito.Mockito.*; // mock creation List

    mockedList = mock(List.class); // using mock object - it does not throw any "unexpected interaction" exception mockedList.add("one"); mockedList.clear(); // selective, explicit, highly readable verification verify(mockedList).add("one"); verify(mockedList).clear(); ରࣁ؀ উ٘۽੉٘ ѐߊ ঱য ௏ౣܽ, द੘ೞӝ thdev.tech, 2016 6
  7. Mockito - verify // you can mock concrete classes, not

    only interfaces LinkedList mockedList = mock(LinkedList.class); // stubbing appears before the actual execution when(mockedList.get(0)).thenReturn("first"); // the following prints "first" System.out.println(mockedList.get(0)); // the following prints "null" because get(999) was not stubbed System.out.println(mockedList.get(999)); ରࣁ؀ উ٘۽੉٘ ѐߊ ঱য ௏ౣܽ, द੘ೞӝ thdev.tech, 2016 7
  8. పझ౟ ૓೯ ରࣁ؀ উ٘۽੉٘ ѐߊ ঱য ௏ౣܽ, द੘ೞӝ thdev.tech, 2016

    8
  9. Mockito-Kotlin 4 Kotlin ޙߨী ݏѱ పझ౟ೡ ࣻ ੓ח mockito 4

    Mockito-Kotlin ରࣁ؀ উ٘۽੉٘ ѐߊ ঱য ௏ౣܽ, द੘ೞӝ thdev.tech, 2016 9
  10. Mockito-Kotlin repositories { mavenCentral() } dependencies { testCompile 'com.nhaarman:mockito-kotlin:0.12.1' }

    ରࣁ؀ উ٘۽੉٘ ѐߊ ঱য ௏ౣܽ, द੘ೞӝ thdev.tech, 2016 10
  11. Mockito-Kotlin ୶о೮؊פ য়ܨо! Conflict with dependency 'org.jetbrains.kotlin:kotlin- stdlib'. Resolved versions

    for app (1.0.5) and test app (1.0.5-2) differ. See http://g.co/androidstudio/app- test-app-conflict for details. ରࣁ؀ উ٘۽੉٘ ѐߊ ঱য ௏ౣܽ, द੘ೞӝ thdev.tech, 2016 11
  12. Mockito-Kotlin repositories { mavenCentral() } dependencies { testCompile 'com.nhaarman:mockito-kotlin:0.12.1', {

    exclude group: "org.jetbrains.kotlin", module: 'kotlin-stdlib' } } ରࣁ؀ উ٘۽੉٘ ѐߊ ঱য ௏ౣܽ, द੘ೞӝ thdev.tech, 2016 12
  13. Mockito-Kotlin Mockito : mock(ImageViewAdapterContract.Model::class.java) Mockito-Kotlin : mock<ImageViewAdapterContract.View>() ରࣁ؀ উ٘۽੉٘ ѐߊ

    ঱য ௏ౣܽ, द੘ೞӝ thdev.tech, 2016 13
  14. Mockito-Kotlin @Test fun test(){ /* Given */ val mock =

    mock<MyClass> { on { getText() } doReturn "text" } val classUnderTest = ClassUnderTest(mock) /* When */ classUnderTest.doAction() /* Then */ verify(mock).doSomething(any()) } ରࣁ؀ উ٘۽੉٘ ѐߊ ঱য ௏ౣܽ, द੘ೞӝ thdev.tech, 2016 14
  15. ଵҊ ੗ܐ 4 Mockito 4 Mockito-Kotlin 4 androidTest - JUnit4,

    Espressoܳ ੉ਊೠ పझ౟ ௏٘ ੘ࢿ ରࣁ؀ উ٘۽੉٘ ѐߊ ঱য ௏ౣܽ, द੘ೞӝ thdev.tech, 2016 15
  16. ׮਺਷ 4 Renderscript APIਸ ੉ਊೠ ৘ઁ ରࣁ؀ উ٘۽੉٘ ѐߊ ঱য

    ௏ౣܽ, द੘ೞӝ thdev.tech, 2016 16