<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The Official Joroto Blog &#187; junit</title>
	<atom:link href="http://www.joroto.com/blog/tag/junit/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.joroto.com/blog</link>
	<description>From the people at Joroto, Inc.</description>
	<lastBuildDate>Thu, 20 Oct 2011 21:10:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Appfuse &#8211; Test failure</title>
		<link>http://www.joroto.com/blog/2010/02/14/appfuse-test-failure/</link>
		<comments>http://www.joroto.com/blog/2010/02/14/appfuse-test-failure/#comments</comments>
		<pubDate>Sun, 14 Feb 2010 23:44:12 +0000</pubDate>
		<dc:creator>Tom CTO</dc:creator>
				<category><![CDATA[Miscellaneous Apps and Services]]></category>
		<category><![CDATA[appfuse]]></category>
		<category><![CDATA[junit]]></category>
		<category><![CDATA[mvn]]></category>
		<category><![CDATA[web testing]]></category>

		<guid isPermaLink="false">http://www.joroto.com/blog/?p=385</guid>
		<description><![CDATA[Sometimes the tests will fail because you have generated your classes in an order that does not support the tests. For example, I have a Base class that is included as an attribute of another class. However, I had made &#8230; <a href="http://www.joroto.com/blog/2010/02/14/appfuse-test-failure/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Sometimes the tests will fail because you have generated your classes in an order that does not support the tests.<br />
For example, I have a Base class that is included as an attribute of another class. However, I had made a change in the base class and regenerated the code. This causes the file in ./tree/src/test/resources/sample-data.xml to generate the data in the wrong order. So what happens is that there are zero base class records in the table when the other class runs its test. This second class is, due to me regenerating the base class, now first in the sample data and first to be tested.</p>
<p>The fix:<br />
To fix this, just move the data around in the sample-data.xml file. Poof no more Constraint problem.</p>
<p>Example pseduocode:<br />
Class Communications {<br />
   Long uid;<br />
   Email email;<br />
   { . . . methods . . . }<br />
}<br />
This Communications class is first in the sample-data.xml file because the Email class was generated second<br />
Class Email {<br />
    Long uid;<br />
    String emailAddr;<br />
   { . . . methods . . .}<br />
}<br />
So initially I had autogenerated the Email class first. Then made an addition to the email class&#8217;s attributes. Then regenerated it with<br />
mvn appfuse:gen -Dentity=Email ; mvn appfuse:install -Dentity=Email<br />
Did my fixup of the ./tree/src/main/webapp/WEB-INF/applicationContext.xml<br />
Finally    mvn test<br />
So before the   mvn test  fix the sample-data.xml file and you&#8217;ll be fine.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.joroto.com%2Fblog%2F2010%2F02%2F14%2Fappfuse-test-failure%2F&amp;title=Appfuse%20%26%238211%3B%20Test%20failure" id="wpa2a_2"><img src="http://www.joroto.com/blog/wp-content/plugins/add-to-any/share_save_256_24.png" width="256" height="24" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.joroto.com/blog/2010/02/14/appfuse-test-failure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

