瀏覽代碼

Properly pull in Hamcrest matchers.

Sam Jaffe 5 年之前
父節點
當前提交
19b455e8a9

+ 0 - 1
pom.xml

@@ -113,7 +113,6 @@
       <groupId>org.hamcrest</groupId>
       <artifactId>hamcrest-all</artifactId>
       <version>1.3</version>
-      <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>org.leumasjaffe</groupId>

+ 5 - 7
src/test/java/org/leumasjaffe/recipe/model/CardTest.java

@@ -2,7 +2,7 @@ package org.leumasjaffe.recipe.model;
 
 import static org.junit.jupiter.api.Assertions.*;
 import static org.hamcrest.MatcherAssert.*;
-import static org.hamcrest.core.Is.*;
+import static org.hamcrest.collection.IsCollectionWithSize.*;
 import static org.hamcrest.core.IsCollectionContaining.*;
 
 import java.util.Arrays;
@@ -61,8 +61,7 @@ class CardTest {
 		final Step step = new Step();
 		step.setIngredients(Arrays.asList(new Ingredient("TEST", "", _1g)));
 		card.setCooking(Arrays.asList(step, step));
-		// TODO Figure out why hamcrest-all isn't loading...
-		assertThat(card.getIngredients().size(), is(1));
+		assertThat(card.getIngredients(), hasSize(1));
 		assertThat(card.getIngredients(),
 				hasItem(new Ingredient("TEST", "", new Amount("2 g"))));
 	}
@@ -75,8 +74,7 @@ class CardTest {
 				new Ingredient("TEST", "A", _1g),
 				new Ingredient("TEST", "B", _1g)));
 		card.setCooking(Arrays.asList(step));
-		// TODO Figure out why hamcrest-all isn't loading...
-		assertThat(card.getIngredients().size(), is(2));
+		assertThat(card.getIngredients(), hasSize(2));
 	}
 
 	@Test
@@ -88,9 +86,9 @@ class CardTest {
 				new Ingredient("B", "TEST", _1g)));
 		card.setCooking(Arrays.asList(step));
 		card.setPreparation(new Preparation());
-		assertThat(card.getIngredients().size(), is(2));
+		assertThat(card.getIngredients(), hasSize(2));
 		final Preparation prep = card.getPreparation().get();
-		assertThat(prep.getIngredients().size(), is(1));
+		assertThat(prep.getIngredients(), hasSize(1));
 		assertThat(prep.getIngredients(), hasItem(new Ingredient("B", "TEST", _1g)));
 	}
 }

+ 2 - 3
src/test/java/org/leumasjaffe/recipe/model/ProductTest.java

@@ -1,7 +1,7 @@
 package org.leumasjaffe.recipe.model;
 
 import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
+import static org.hamcrest.collection.IsCollectionWithSize.*;
 import static org.hamcrest.core.IsCollectionContaining.hasItem;
 
 import java.util.Arrays;
@@ -21,8 +21,7 @@ class ProductTest {
 				new Ingredient("TEST", "B", _1g)));
 		card.setCooking(Arrays.asList(step));
 		prod.setCards(Arrays.asList(card));
-		// TODO Figure out why hamcrest-all isn't loading...
-		assertThat(prod.getIngredients().size(), is(1));
+		assertThat(prod.getIngredients(), hasSize(1));
 		assertThat(prod.getIngredients(),
 				hasItem(new Ingredient("TEST", "", new Amount("2 g"))));
 	}

+ 2 - 3
src/test/java/org/leumasjaffe/recipe/model/RecipeTest.java

@@ -1,7 +1,7 @@
 package org.leumasjaffe.recipe.model;
 
 import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
+import static org.hamcrest.collection.IsCollectionWithSize.*;
 import static org.hamcrest.core.IsCollectionContaining.hasItem;
 
 import java.util.Arrays;
@@ -23,8 +23,7 @@ class RecipeTest {
 		card.setCooking(Arrays.asList(step));
 		prod.setCards(Arrays.asList(card));
 		recipe.setProducts(Arrays.asList(prod, prod));
-		// TODO Figure out why hamcrest-all isn't loading...
-		assertThat(recipe.getIngredients().size(), is(1));
+		assertThat(recipe.getIngredients(), hasSize(1));
 		assertThat(recipe.getIngredients(),
 				hasItem(new Ingredient("TEST", "", new Amount("4 g"))));
 	}

+ 2 - 3
src/test/java/org/leumasjaffe/recipe/model/StepTest.java

@@ -1,7 +1,7 @@
 package org.leumasjaffe.recipe.model;
 
 import static org.hamcrest.MatcherAssert.*;
-import static org.hamcrest.core.Is.*;
+import static org.hamcrest.collection.IsCollectionWithSize.*;
 
 import java.util.Arrays;
 
@@ -16,8 +16,7 @@ class StepTest {
 		step.setIngredients(Arrays.asList(
 				new Ingredient("TEST", "", _1g),
 				new Ingredient("TEST", "", _1g)));
-		// TODO Figure out why hamcrest-all isn't loading...
-		assertThat(step.getIngredients().size(), is(2));
+		assertThat(step.getIngredients(), hasSize(2));
 	}
 
 }