Momenton - code challenge
- Scala's rich collections make it easy to model the problem
- Declarative programming paradigm is easier to comprehend
- Download and install JDK 8 on your local machine
- Download and install Scala
- Install and setup SBT on your local machine.
- Open console and navigate to the root directory of this project
- Run sbt (sbt will download/manage all dependencies)
$ sbt run
Or from sbt console,
> run
Below is an example output:
>sbt run
[info] Running momenton.code.challenge.CompanyHierarchy
Jamie | |
| Allan |
| | Martin
| | Alex
| Steve |
| | David
Adam | |
| James |
| | Will
| | Mike
| Matt |
| | Lucy
Employees with no manager: List(Spider-Man, Hulk, Thor, Iron Man)
--------------------------
<table>
<tr><td>employeeRecord</td><td></td><td></td></tr>
<tr><td></td><td>employeeRecord</td><td></td></tr>
<tr><td></td><td></td><td>employeeRecord</td></tr>
<tr><td></td><td></td><td>employeeRecord</td></tr>
<tr><td></td><td>employeeRecord</td><td></td></tr>
<tr><td></td><td></td><td>employeeRecord</td></tr>
</table>
<table>
<tr><td>employeeRecord</td><td></td><td></td></tr>
<tr><td></td><td>employeeRecord</td><td></td></tr>
<tr><td></td><td></td><td>employeeRecord</td></tr>
<tr><td></td><td></td><td>employeeRecord</td></tr>
<tr><td></td><td>employeeRecord</td><td></td></tr>
<tr><td></td><td></td><td>employeeRecord</td></tr>
</table>
Employees with no manager: List(Spider-Man, Hulk, Thor, Iron Man)
[success] Total time: 3 s, completed 17/05/2017 2:31:43 PM
First assemble(using sbt-assembly plugin) the application with sbt:
$ sbt assembly
or from sbt console
> assembly
sbt-assembly will execute all unit tests before packaging the application jar file with all dependencies included.
The generated jar file is placed under target/scala-2.11/Momenton - code challenge-assembly-0.1-SNAPSHOT.jar
I have renamed the jar file to app.jar for convenience
To execute the generated jar file, go to the directory where the jar file is generated:
$ scala app.jar
$ sbt test
$ sbt clean coverage test
$ sbt coverageReport
The generated coverage reports(in HTML) can be found in target/scala-2.11/scoverage-report
- Scala - Object-Oriented Meets Functional
- sbt - The interactive build tool
- Intellij IDE - Capable and Ergonomic IDE for JVM
- Hanyun(Allan) Gong - Linkedin
This project is licensed under the MIT License - see the LICENSE.md file for details