In my custom Mojo project, I'm trying to write tests in my src/test/java directory that will validate I'm throwing the correct errors when I have a mis-configuration. Although I'm fairly new to Maven, don't all tests in src/test/java have to be in Java/JUnit? - Dave
Anders Hammar wrote: > > No, but I could easily be used to verify that the pom configuration is > correct. Or do you *have* to use JUnit? > > /Anders > > On Thu, Aug 11, 2011 at 20:17, laredotornado > <[email protected]>wrote: > >> >> Is the invoker plugin intended to be used in a JUnit context? I wanted >> to >> write my integration tests using JUnit 4 but can't find an example that >> has >> Java code to do this. Thanks, - Dave >> >> >> >> Anders Hammar wrote: >> > >> > I would use the invoker plugin. If you look at nearly any maven plugin >> > here >> > at Mojo (the source code), you'll see examples of that type of >> integration >> > testing. >> > >> > /Anders >> > >> > On Wed, Aug 10, 2011 at 16:09, laredotornado >> > <[email protected]>wrote: >> > >> >> >> >> Hi, >> >> >> >> I'm developing my own custom Mojo. I want to test the case where >> someone >> >> hasn't entered the correct configuration, so my code has … >> >> >> >> >> >> public class SeleniumTestMojo extends AbstractMojo { >> >> >> >> ... >> >> public void execute() throws MojoExecutionException { >> >> try { >> >> … >> >> // Verify hosts are non-empty. >> >> if (hosts != null && hosts.isEmpty()) { >> >> throw new MojoExecutionException("Plugin execution requires >> >> one >> >> or more hosts."); >> >> } >> >> >> >> >> >> I have an XML file that represents the misconfigured plugin, but I >> have >> >> no >> >> idea how to write an integration test to check for this kind of >> >> exception. >> >> Any advice or examples about writing integration tests is greatly >> >> appreciated, - Dave >> >> >> >> >> >> -- >> >> View this message in context: >> >> >> http://old.nabble.com/Integration-testing-for-my-custom-Mojo-tp32234324p32234324.html >> >> Sent from the mojo - user mailing list archive at Nabble.com. >> >> >> >> >> >> --------------------------------------------------------------------- >> >> To unsubscribe from this list, please visit: >> >> >> >> http://xircles.codehaus.org/manage_email >> >> >> >> >> >> >> > >> > >> >> -- >> View this message in context: >> http://old.nabble.com/Integration-testing-for-my-custom-Mojo-tp32234324p32244345.html >> Sent from the mojo - user mailing list archive at Nabble.com. >> >> >> --------------------------------------------------------------------- >> To unsubscribe from this list, please visit: >> >> http://xircles.codehaus.org/manage_email >> >> >> > > -- View this message in context: http://old.nabble.com/Integration-testing-for-my-custom-Mojo-tp32234324p32244564.html Sent from the mojo - user mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
