Coder Social home page Coder Social logo

dogapi's Introduction

DogApi

Integrating Retrofit 2.6.0, coroutines, Android Architecture Components, Koin modules, Koin and coroutine testing, Koin android ViewModel injection, Mockito Kotlin, LiveData testing.

Not just for dogs

This actually lets me try out all sorts of APIs for cat pictures too. https://github.com/public-apis/public-apis#animals

Modules in Koin

This is a demonstration application for all the technologies we are going to be using in the later versions of our commercial application. The testing framework will make unit tests much faster, because they can be run from the development machine without deploying APK to a simulator. The tests in this project run in less than two seconds.

Android Architecture Components

The viewmodel in the project is subject to two unit tests:

1

  • GIVEN a mocked CatApi retrofit implementation, injected into the viewmodel by Koin
  • WHEN we call the viewmodel with the method called by clicking the FAB on the UI
  • THEN we wait for the LiveData component to return, with the data returned by the mocked CatApi

2

  • GIVEN a mocked CatApi retrofit implementation, injected into the viewmodel by Koin, which always throws an Exception
  • WHEN we call the viewmodel with the method called by clicking the FAB on the UI
  • THEN we wait for two LiveData components
    • An error message in .error
    • No data returned in the .message live data

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.