#####The project is in Java 11
This project has the main goal to generate all possible combinations giving an input os packages. The algorithm should select the lighter and expensive combination of items.
To run the API you just need to import the API in your project and call the method Packer.pack(filePath)
passing a valid input file. Use the example_input file in the project folder to test.
Add the dependency:
<dependency>
<groupId>com.mobiquity</groupId>
<artifactId>packer</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
mvn clean install
public static void main(String[] args) throws APIException {
System.out.println(Packer.pack("path/to/file"));
}
I separated the hole flux in 4 steps:
- Read the file
- Validate the packages
- Generate all items possibilities
- Format the output
To call those steps I used the Facade pattern to make my code fluent
- I used JUnit for unit tests and Mockito to mock the integration tests, specifically the file reading process
- The Fixture library is being used to generate the test templates and model cases
To log infos the logback and SLF4j are being used together
To read the file, I used Regex to match the pattern of packages and Commons-IO lib to extract the file info
To generate all items combinations I used the Forward-Backward Algorithm
Used Maven to manage dependencies
- Java 11
- Lombok
- Commons-IO
- Logback
- SLF4J
- JUnit
- Mockito