TODO API Client Kata for Kotlin Developers. The main goal is to practice integration testing using MockWebServer

Overview

Karumi logo KataTODOApiClient for Kotlin Build Status

  • We are here to practice integration testsing using HTTP stubbing.
  • We are going to use MockWebServer to simulate a HTTP server.
  • We are going to use JUnit to perform assertions.
  • We are going to practice pair programming.

Getting started

This repository contains an API client to interact with a remote service we can use to implement a TODO application.

This API Client is based on one class with name TodoApiClient containing some methods to interact with the API. Using this class we can get all the tasks we have created before, get a task using the task id, add a new task, update a task or delete an already created task.

The API client has been implemented using a networking framework named Retrofit. Review the project documentation if needed.

Tasks

Your task as a Kotlin Developer is to write all the integration tests needed to check if the API Client is working as expected.

This repository is ready to build the application, pass the checkstyle and your tests in Travis-CI environments.

Our recommendation for this exercise is:

  • Before starting

    1. Fork this repository.
    2. Checkout kata-todo-api-client branch.
    3. Execute the repository playground and make yourself familiar with the code.
    4. Execute TodoApiClientTest and watch the only test it contains pass.
  • To help you get started, these are some tests already written at TodoApiClientTest class. Review it carefully before to start writing your own tests. Here you have the description of some tests you can write to start working on this Kata:

    1. Test that the Accept and ContentType headers are sent.
    2. Test that the list of TaskDto instances obtained invoking the getter method of the property allTasks contains the expected values.
    3. Test that the request is sent to the correct path using the correct HTTP method.
    4. Test that adding a task the body sent to the server is the correct one.

Considerations

  • If you get stuck, master branch contains all the tests already solved.

  • You will find some utilities to help you test the APIClient easily in: MockWebServerTest and the test resources directory.

Extra Tasks

If you've covered all the application functionality using integration tests you can continue with some extra tasks:

  • Replace some integration tests we have created with unit tests. A starting point could be the DefaultHeadersInterceptor class.
  • Create your own API client to consume one of the services described in this web: http://jsonplaceholder.typicode.com/

Documentation

There are some links which can be useful to finish these tasks:

Contributors

Thank you all for your work!


Igor Ganapolsky

License

Copyright 2017 Karumi

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Comments
  • Support latest java version exercises branch.

    Support latest java version exercises branch.

    As I've done with master, I've updated the TravisCI configuration to specify the java version we want to use when running our CI tasks. It doesn't really matter if jdk is 8, 9, 10 or 12 so I used the one the build is configured to target. Additionally, I've updated the gradle version 😃

    Closes #8

    opened by pedrovgs 0
  • Support latest java version

    Support latest java version

    I've updated the TravisCI configuration to specify the java version we want to use when running our CI tasks. It doesn't really matter if jdk is 8, 9, 10 or 12 so I used the one the build is configured to target. Additionally, I've updated the gradle version 😃

    Closes #8

    opened by pedrovgs 0
  • Recreate the project so it works with the latest gradle and java versions

    Recreate the project so it works with the latest gradle and java versions

    During the last training we noticed there were people who couldn't open the repository because of the gradle version and the java version they were using. We should ensure we can get the repository working with java 12 installed.

    We should also review Travis-CI configuration because the JDK is not forced to any version.

    opened by pedrovgs 0
  • Update master dependencies

    Update master dependencies

    • Update to kotlin 1.3
    • Update most dependencies to their most recent version
    • Remove Either implementation from funktionale now that it is now part of Arrow and use our own implementation instead.
    • Fix linting
    opened by Serchinastico 0
  • Add contributors section to the README

    Add contributors section to the README

    Add a new section listing the contributors for the project, in this repository, only Igor is included but we can try using the same format in other projects as well.

    opened by Serchinastico 0
  • Update gradle and dependencies to latest of everything

    Update gradle and dependencies to latest of everything

    This is meant to replace #2 to fix travis while keeping the original author :)

    Friendly reminder: After merging this branch I'll take care of introducing the same changes into the kata-todo-api-client branch.

    opened by Serchinastico 0
  • Add tests

    Add tests

    :cyclone: Git merge message

    • Add ktlint
    • Replace exception driven design with funktionale.Either + sealed classes
    • Replace TaskDTO with a data class
    • Make the code more kotlin friendly
    opened by Serchinastico 0
Owner
Karumi
Karumi, the Rock Solid Code studio
Karumi
Maxibon kata for Kotlin Developers. The main goal is to practice property based testing.

Kata Maxibon for Kotlin. We are here to practice property based testing. We are going to use KotlinTest to write our tests. We are going to practice p

Karumi 44 Oct 3, 2022
Screenshot Kata for Android Developers with Kotlin. The main goal is to practice UI Screenshot Testing.

KataScreenshot in Kotlin We are here to practice UI testing using screenshot tests for Android. We are going to use Espresso to interact with the Appl

Karumi 76 Nov 20, 2022
Super Heroes Kata for Android Developers in Kotlin. The main goal is to practice UI Testing.

KataSuperHeroes in Kotlin We are here to practice UI Testing. We are going to use Espresso to interact with the Application UI. We are going to use Ko

Karumi 86 Nov 20, 2022
KataContacts written in Kotlin. The main goal is to practice Clean Architecture Development

KataContacts written in Kotlin We are here to practice Clean Architecture Development. Clean Architecture is a way of structuring code. We are going t

Karumi 48 Oct 3, 2022
Android Kotlin+ MVVM + Retrofit2 + Room +Dagger2 + Coroutines + Junit4 + Espresso + Mockito + MockWebServer

Movies-TMDB Android Kotlin+ MVVM + Retrofit2 + Room +Dagger2 + Coroutines + Junit4 + + Espresso + Mockito + MockWebServer Movies-TMDB Android Movies-T

kavin 2 Oct 24, 2022
🔥The Android Startup library provides a straightforward, performant way to initialize components at the application startup. Both library developers and app developers can use Android Startup to streamline startup sequences and explicitly set the order of initialization.

??The Android Startup library provides a straightforward, performant way to initialize components at the application startup. Both library developers and app developers can use Android Startup to streamline startup sequences and explicitly set the order of initialization.

Rouse 1.3k Dec 30, 2022
Candroid does things different. The Candroid app store is a library of APK client wrappers (F-Droid, APKPure, etc.) For the main Candroid app store, try visiting the Candroid Market.

Candroid App Store Candroid does things different. The Candroid app store is a library of APK client wrappers (F-Droid, APKPure, etc.) For the main Ca

Sean P. Myrick V19.1.7.2 4 Dec 22, 2022
PlaceAutoComplete - Practice Repository for placesearch using google places Api

PlaceAutoComplete Practice Repository for placesearch using google places Api Ap

Nayeem Shiddiki Abir 0 Jan 1, 2022
Simple Todo list API using Spring-Boot, Webflux, Kotlin, Coroutines, & PostgreSQL

Simple Todo list API using Spring-Boot, Webflux, Kotlin, Coroutines, & PostgreSQL

Sami Eljabali 9 Jul 26, 2022
Sample app to demonstrate the integration code and working of Dyte SDK for android, using Kotlin.

Dyte Kotlin Sample App An example app in kotlin using the Dyte Mobile SDK Explore the docs » View Demo · Report Bug · Request Feature Table of Content

Dyte 8 Dec 3, 2021
This is a simple Rest Api for todo application

This is a simple Rest Api for todo application , where users do signup, login and add their respective todos. So this api is fully based on Ktor framework.

Jayant Pandit 8 Sep 14, 2022
A basic template ecommerce application with payment integration made using Android Architechture componets

ShopIt ShopIt is a basic template ecommerce application with payment integration(RazorPay), made using Android Architechture componets and Material Co

Apurva Shukla 2 Nov 22, 2021
A reliable android app that shows upcoming fixtures, updated league tables, and top goal scorers in a league

SwiftScore A football stats and livescore app built with Kotlin,MVVM architecture,Retrofit, Coroutines and Navigation Components Demo Screenshots API

Breens Mbaka 12 Jul 7, 2022
A simple ToDo Task Manager App made in Kotlin using Room DataBase.

ToDo List App ?? About A simple To-Do List Management App that helps you get things done. Built with Kotlin, it helps the user to add their task. User

Tanya Gupta 17 Dec 12, 2022
The home of the amigo-platform which serves as the main service for the amigo multimedia platform

amigo-platform This is the home of the amigo-platform which serves as the main service for the amigo multimedia platform. Authentication with JWT Toke

null 1 Nov 22, 2021
This app works as a simple replacement for SpongeAuth for those who want to use Discourse as the main SSO auth provider.

PowerNukkit Ore to Discourse Auth Gateway This app works as a simple replacement for SpongeAuth for those who want to use Discourse as the main SSO au

null 1 Apr 9, 2022
Basic RestAPI to practice my skills working with Spring/Kotlin/Gradle

Dining Review API Dining Review API is a basic RestAPI roughly based on the requirements given in a Milestone project in the Building REST APIs with J

Jonas Kuhlo 0 Nov 18, 2021
Example of Android project showing integration with Kotlin and Dagger 2

kotlin-dagger-example This project demonstrate how to setup an Android Project with Kotlin and Dagger 2. It's based on Dagger 2 example ##Known issues

Damian Petla 533 Nov 11, 2022