GithubHelp home page GithubHelp logo

dependency-injection-java's Introduction

Synopsis

This project contains an example of dependency injection implemented in Java. As a review the project solves the following:

  • A file consists of a sequence of ASCII characters.
    A sequence of one or more digits followed by a non-digit represents a decimal integer.
    The file includes no negative numbers.
    Write a program to
    * add all the numbers in the file,
    * count how many times each ASCII character occurs in the file,
    * output the result to a file.
    You may assume that the sum of the numbers will not exceed the maximum value of an integer.
    A sample input file and a valid output file are attached.

  • Develop tests or advise a test strategy to adequately test the developed code.

I followed the design pattern of Dependency Injection. The injection is performed in the constructor of the Client class which receives the Service as argument.

This project has been developed using NetBeans IDE 8.1.

My code can be found in the /src/ folder. My tests can be found in the /test/ folder.

How to run

Please place your input files in the main folder. Then run the project, in the standard ouput you'll receive a message to provide your file name. Please type the name and press ENTER.
A file named Output.txt will be generated in the same folder containing the result.

API Reference

To avoid increase of the size of the submitted folder, the /dist/ directory containing the javadoc generated API files has not been included. However it can be generated from any modern IDE.

Tests

To test the solution I performed unit tests for the FileProcessingConsumer and FileProcessingService classes. The unit tests use JUnit4 and they are located in the /test/ folder

Author

Fernando Diaz Caballero [email protected]

License

GNU GENERAL PUBLIC LICENSE

dependency-injection-java's People

Contributors

fdiazcaballero avatar

Watchers

James Cloos avatar  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.