Giter Club home page Giter Club logo

koth-hiring-assignment's Introduction

Library application

Introduction

You are creating an application allowing a library to manage books count. Your current task is to finish implementation of missing service methods. Data store is accessed by repository layer to which interfaces are provided in repository package.

Problem statement

Implement borrowBook method in the BookService class which should:

  • Save information that user borrowed particular book from library
  • Decrement available book copies count at library by 1
  • Throw BookNotFoundException if the book is not available in data store
  • Throw BookNotAvailableException if the book count is already equal to 0
  • Throw BookAlreadyBorrowedException if the book is already borrowed by the user

Implement returnBook method in the BookService class which should:

  • Save information that user returned particular book to library
  • Increment available book copies count at library by 1
  • Throw BookBorrowingNotFoundException if the user does not have such book borrowed in data store

Implement addBookCopy method in the BookService class which should:

  • Save a book copies count of 1 if the book is not present in data store
  • Increment copies count by 1 if the book is already present in data store

Implement removeBookCopy method in the BookService class which should:

  • Decrement copies count by 1 if the book is present in data store
  • Throw BookNotFoundException if the book is not present in data store
  • Throw BookNotAvailableException if the book count is already equal to 0

Implement getAvailableBookCopies method in the BookService class which should:

  • Return book count if the book is present in data store
  • Throw BookNotFoundException if the book is not present in data store

Hints

  • Repository interfaces contain Javadocs describing their methods behaviour
  • You are not allowed to add/delete/modify methods available in repository interface
  • You are not allowed to modify existing tests, but you are free to add new ones
  • Remember to keep high code quality

koth-hiring-assignment's People

Contributors

shashankdaima avatar

Watchers

 avatar

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.