ImportRecipeMLTest.java 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /* ===================================================================
  2. * ImportRecipeMLTest.java
  3. *
  4. * Created Feb 14, 2005 4:15:19 PM
  5. *
  6. * Copyright (c) 2005 Matt Magoffin (spamsqr@msqr.us)
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  21. * 02111-1307 USA
  22. * ===================================================================
  23. * $Id: ImportRecipeMLTest.java 30 2009-05-04 01:53:34Z msqr $
  24. * ===================================================================
  25. */
  26. package magoffin.matt.ieat.biz.test;
  27. import java.io.InputStream;
  28. import magoffin.matt.ieat.biz.RecipeIOBiz;
  29. import magoffin.matt.ieat.domain.Recipe;
  30. import magoffin.matt.ieat.test.AbstractSpringEnabledTest;
  31. /**
  32. * Test case for importing a RecipeML recipe.
  33. *
  34. * @author Matt Magoffin (spamsqr@msqr.us)
  35. * @version $Revision: 30 $ $Date: 2009-05-04 13:53:34 +1200 (Mon, 04 May 2009) $
  36. */
  37. public class ImportRecipeMLTest extends AbstractSpringEnabledTest {
  38. /**
  39. * Test able to load recipe ML.
  40. * @throws Exception if any error occurs
  41. */
  42. public void testImportHoaxRecipeML() throws Exception {
  43. InputStream hoaxIn = this.getClass().getClassLoader().getResourceAsStream(
  44. "magoffin/matt/ieat/biz/test/data/recipeml/hoax.xml");
  45. assertTrue("hoax XML resource should not be null",hoaxIn != null);
  46. RecipeIOBiz rioBiz = getRecipeIOBiz();
  47. Recipe hoaxRecipe = rioBiz.createFromRecipeML(hoaxIn);
  48. assertTrue("Imported RecipeML Recipe should not be null",hoaxRecipe != null);
  49. }
  50. /**
  51. * @return the RecipeIOBiz
  52. */
  53. protected RecipeIOBiz getRecipeIOBiz() {
  54. return (RecipeIOBiz)getContext().getBean("recipeIOBiz");
  55. }
  56. }