Work in progress.
This commit is contained in:
@@ -8,6 +8,7 @@ import static org.hamcrest.CoreMatchers.*;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import net.woodyfolsom.cs6601.p2.Ingredient.TYPE;
|
||||
import net.woodyfolsom.cs6601.p2.Recipe;
|
||||
import net.woodyfolsom.cs6601.p2.RecipeBook;
|
||||
import net.woodyfolsom.cs6601.p2.RecipeBookReader;
|
||||
@@ -17,15 +18,23 @@ import org.junit.Test;
|
||||
public class RecipeBookReaderTest {
|
||||
|
||||
@Test
|
||||
public void testReadRecipeBook() {
|
||||
RecipeBook recipeBook = RecipeBookReader.readRecipeBook(new File("data/PastelVasco.xml"));
|
||||
public void testReadSurveyDataset() {
|
||||
RecipeBook recipeBook = RecipeBookReader.readRecipeBook(new File("data/survey_recipes.xml"));
|
||||
assertNotNull(recipeBook);
|
||||
assertThat(recipeBook.getSize(), is(equalTo(1)));
|
||||
assertThat(recipeBook.getSize(), is(equalTo(22)));
|
||||
|
||||
Recipe recipe = recipeBook.getRecipe(0);
|
||||
assertThat(recipe.getHead().getTitle(), is(equalTo("Gateau Basque / Pastel Vasco")));
|
||||
assertTrue(recipe.getHead().isCategoryMatch("Desserts"));
|
||||
assertTrue(recipe.getHead().isCategoryMatch("Sweets"));
|
||||
assertFalse(recipe.getHead().isCategoryMatch("Meat"));
|
||||
System.out.println(recipe.getHead().getTitle());
|
||||
assertThat(recipe.getHead().getTitle(), is(equalTo("Honey cake")));
|
||||
assertTrue(recipe.getIngredients().contains(TYPE.EGGS));
|
||||
assertTrue(recipe.getIngredients().contains(TYPE.GLUTEN));
|
||||
assertTrue(recipe.getIngredients().contains(TYPE.SPICE));
|
||||
assertFalse(recipe.getIngredients().contains(TYPE.RED_MEAT));
|
||||
assertFalse(recipe.getIngredients().contains(TYPE.POULTRY));
|
||||
assertFalse(recipe.getIngredients().contains(TYPE.SHELLFISH));
|
||||
|
||||
for (int rIndex = 0; rIndex < recipeBook.getSize(); rIndex++) {
|
||||
System.out.println(recipeBook.getRecipe(rIndex).getHead().getTitle());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
31
test/net/woodyfolsom/cs6601/p2/RecipeReaderTest.java
Normal file
31
test/net/woodyfolsom/cs6601/p2/RecipeReaderTest.java
Normal file
@@ -0,0 +1,31 @@
|
||||
package net.woodyfolsom.cs6601.p2;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import net.woodyfolsom.cs6601.p2.Recipe;
|
||||
import net.woodyfolsom.cs6601.p2.RecipeBook;
|
||||
import net.woodyfolsom.cs6601.p2.RecipeBookReader;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class RecipeReaderTest {
|
||||
|
||||
@Test
|
||||
public void testReadRecipeBook() {
|
||||
RecipeBook recipeBook = RecipeBookReader.readRecipeBook(new File("data/PastelVasco.xml"));
|
||||
assertNotNull(recipeBook);
|
||||
assertThat(recipeBook.getSize(), is(equalTo(1)));
|
||||
|
||||
Recipe recipe = recipeBook.getRecipe(0);
|
||||
assertThat(recipe.getHead().getTitle(), is(equalTo("Gateau Basque / Pastel Vasco")));
|
||||
assertTrue(recipe.getHead().isCategoryMatch("Desserts"));
|
||||
assertTrue(recipe.getHead().isCategoryMatch("Sweets"));
|
||||
assertFalse(recipe.getHead().isCategoryMatch("Meat"));
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
package net.woodyfolsom.cs6601.p2;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import net.woodyfolsom.cs6601.p2.Ingredient.TYPE;
|
||||
import net.woodyfolsom.cs6601.p2.Recipe;
|
||||
import net.woodyfolsom.cs6601.p2.RecipeBook;
|
||||
import net.woodyfolsom.cs6601.p2.RecipeBookReader;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class SurveyDatasetReaderTest {
|
||||
|
||||
@Test
|
||||
public void testReadSurveyDataset() {
|
||||
RecipeBook recipeBook = RecipeBookReader.readRecipeBook(new File("data/survey_dataset.xml"));
|
||||
assertNotNull(recipeBook);
|
||||
assertThat(recipeBook.getSize(), is(equalTo(22)));
|
||||
|
||||
Recipe recipe = recipeBook.getRecipe(0);
|
||||
System.out.println(recipe.getHead().getTitle());
|
||||
assertThat(recipe.getHead().getTitle(), is(equalTo("Honey cake")));
|
||||
assertTrue(recipe.getIngredients().contains(TYPE.EGGS));
|
||||
assertTrue(recipe.getIngredients().contains(TYPE.GLUTEN));
|
||||
assertTrue(recipe.getIngredients().contains(TYPE.SPICE));
|
||||
assertFalse(recipe.getIngredients().contains(TYPE.RED_MEAT));
|
||||
assertFalse(recipe.getIngredients().contains(TYPE.POULTRY));
|
||||
assertFalse(recipe.getIngredients().contains(TYPE.SHELLFISH));
|
||||
|
||||
for (int rIndex = 0; rIndex < recipeBook.getSize(); rIndex++) {
|
||||
System.out.println(recipeBook.getRecipe(rIndex).getHead().getTitle());
|
||||
}
|
||||
}
|
||||
}
|
||||
24
test/net/woodyfolsom/cs6601/p2/SurveyReaderTest.java
Normal file
24
test/net/woodyfolsom/cs6601/p2/SurveyReaderTest.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package net.woodyfolsom.cs6601.p2;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.hamcrest.core.IsEqual.equalTo;
|
||||
import static org.hamcrest.core.Is.*;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class SurveyReaderTest {
|
||||
|
||||
@Test
|
||||
public void testReadSurveyDataset() {
|
||||
Survey survey = SurveyReader.readSurvey(new File("data/survey.xml"));
|
||||
assertNotNull(survey);
|
||||
|
||||
assertThat(survey.getDinerCount(), equalTo(5));
|
||||
|
||||
Diner diner = survey.getDiner(0);
|
||||
assertThat(diner.isAllergic(0), is(false));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user