refactor: elements type

main
Moritz Böhme 2024-07-02 10:21:46 +02:00
parent 03d916fa31
commit fa48438183
3 changed files with 24 additions and 4 deletions

View File

@ -2,9 +2,10 @@ package WardrobeBuilder;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
public class WardrobeBuilder {
public static List<List<Integer>> allCombinations(List<Integer> elememts, int target) {
public static List<List<Integer>> allCombinations(Set<Integer> elememts, int target) {
List<Integer> wardrobe = List.of(50);
return List.of(wardrobe);
}

View File

@ -1,6 +1,7 @@
import WardrobeBuilder.WardrobeBuilder;
import java.util.List;
import java.util.Set;
import static org.junit.jupiter.api.Assertions.assertEquals;
@ -8,16 +9,18 @@ class MainTest {
@org.junit.jupiter.api.Test
void onlyOneWardrobeFromOneElement() {
List<Integer> elememts = List.of(50);
Set<Integer> elememts = Set.of(50);
List<List<Integer>> wardrobes = WardrobeBuilder.allCombinations(elememts, 50);
assertEquals(1, wardrobes.size());
}
@org.junit.jupiter.api.Test
void sameHeightFromOneElement() {
List<Integer> elememts = List.of(50);
Set<Integer> elememts = Set.of(50);
List<List<Integer>> wardrobes = WardrobeBuilder.allCombinations(elememts, 50);
List<Integer> wardrobe = wardrobes.getFirst();
assertEquals(wardrobe, elememts);
assertEquals(1, wardrobes.size());
Integer elememt = wardrobe.getFirst();
assertEquals(50, elememt);
}
}

View File

@ -24,5 +24,21 @@
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library" scope="TEST">
<library name="JUnit5.8.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter/5.8.1/junit-jupiter-5.8.1.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-api/5.8.1/junit-jupiter-api-5.8.1.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-commons/1.8.1/junit-platform-commons-1.8.1.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-params/5.8.1/junit-jupiter-params-5.8.1.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-engine/5.8.1/junit-jupiter-engine-5.8.1.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-engine/1.8.1/junit-platform-engine-1.8.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
</component>
</module>