Toy Robot
The robot can read in commands(new features with *) of the following form:
PLACE PLACE 0,0,NORTH,jack
MOVE MOVE jack
LEFT LEFT jack
RIGHT RIGHT jack
REPORT REPORT jack
RESET* RESET
MODE* MODE SINGLE
EXIT* EXIT
EXTEND* EXTEND 10,10
If some commands before a place or an invalid command, it should print the following output:
-------- TOY ROBOT STARTED ---------
ttt
Commands: [PLACE, MOVE, LEFT, RIGHT, REPORT, EXIT, RESET, MODE, EXTEND]
hello
Commands: [PLACE, MOVE, LEFT, RIGHT, REPORT, EXIT, RESET, MODE, EXTEND]
MOVE
Place first
toy_robot
├── module-core -- Service logic layer
├──├──src -- Implement the ICommand to support more commands
├──├──test -- Unit test for service here
├
├── module-terminal -- Input & Output layer(easily for extend a different Input source, probably some chat bot)
├──├──src -- Encode and decode the input and output from console
├──├──test -- Integration test here
Java 1.8
shell script
java -version
Checkout the source code and run the following command in the /toy_robot directory:
```shell script
./mvnw clean package
### Usage
```shell script
java -jar ./module-terminal/target/terminal.jar -Dlog.path=YOUR_LOG_PATH
```shell script
cd ./module-terminal
docker build -t natezhengbne/toy_robot .
docker run -i natezhengbne/toy_robot
### Test
Running the test case
```shell script
./mvnw test
or with external test files
```shell script
./mvnw test -Dtest.folder=YOUR_LOCAL_TEST_DIRECTORY
example: touch a new file name as robot_test.txt in /home/robot_test
PLACE 0,0,NORTH
LEFT
REPORT
Output: 0,0,WEST
```
The unit test will compare the announced result of REPORT command with the content starts with “Output:”