Giter Club home page Giter Club logo

jv-registration-validation's Introduction

Registration Service

Your task is to implement a registration service and write unit tests for it.

Registration service has one method register(User user), that accepts some user (the User.class has already been given to you). This method should register a user (by adding it to Storage) only if the user meets the following criteria:

  • there is no user with such login in the Storage yet
  • the user is at least 18 years old
  • user password is at least 6 characters

In case of invalid data you should throw RuntimeException.

Storage and class StorageDaoImpl for working with the Storage has already been implemented. It has two methods:

  • User add (User user) - which adds a user to the storage
  • User get (String login) - which gets the user from the storage by login or returns null if there is no such user.

Your task is to write as many tests as possible to cover all possible options.

There are a lot of ways to name your test methods. The main point is that they should have informative names and be consistent along with other developers in your team. For this task use such convention: <methodUnderTest>_<state>_<expectedBehavior>; For example, if we are testing the method register with a null
user's age the test method name should be register_nullAge_notOk. notOk is because the test expects the register method to throw an exception.

jv-registration-validation's People

Contributors

maliukdaria avatar resci 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.