From 1e2e6966def8aae45ff1b368c3582b6363c4294d Mon Sep 17 00:00:00 2001 From: mcentner Date: Tue, 9 Dec 2008 11:29:23 +0000 Subject: Updated tests. git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@242 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../slcommands/impl/InfoboxReadComandImplTest.java | 26 +++++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadComandImplTest.java') diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadComandImplTest.java b/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadComandImplTest.java index 7a7b90e3..b0d11d47 100644 --- a/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadComandImplTest.java +++ b/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadComandImplTest.java @@ -25,9 +25,12 @@ import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; import org.junit.Before; -import org.junit.Ignore; +import org.junit.BeforeClass; import org.junit.Test; +import org.springframework.context.ApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; +import at.gv.egiz.bku.slcommands.ErrorResult; import at.gv.egiz.bku.slcommands.InfoboxReadCommand; import at.gv.egiz.bku.slcommands.SLCommand; import at.gv.egiz.bku.slcommands.SLCommandContext; @@ -39,13 +42,20 @@ import at.gv.egiz.bku.slexceptions.SLRuntimeException; import at.gv.egiz.stal.STAL; import at.gv.egiz.stal.dummy.DummySTAL; -@Ignore +//@Ignore public class InfoboxReadComandImplTest { + private static ApplicationContext appCtx; + private SLCommandFactory factory; private STAL stal; + @BeforeClass + public static void setUpClass() { + appCtx = new ClassPathXmlApplicationContext("at/gv/egiz/bku/slcommands/testApplicationContext.xml"); + } + @Before public void setUp() { factory = SLCommandFactory.getInstance(); @@ -71,19 +81,23 @@ public class InfoboxReadComandImplTest { InputStream inputStream = getClass().getClassLoader().getResourceAsStream("at/gv/egiz/bku/slcommands/infoboxreadcommand/IdentityLink.Binary.Invalid-1.xml"); assertNotNull(inputStream); - SLCommandContext context = new SLCommandContext(); + SLCommandContext context = new SLCommandContext(); + context.setSTAL(stal); SLCommand command = factory.createSLCommand(new StreamSource(inputStream), context); assertTrue(command instanceof InfoboxReadCommand); } - @Test(expected=SLCommandException.class) public void testInfboxReadRequestInvalid2() throws SLCommandException, SLRuntimeException, SLRequestException { InputStream inputStream = getClass().getClassLoader().getResourceAsStream("at/gv/egiz/bku/slcommands/infoboxreadcommand/IdentityLink.Binary.Invalid-2.xml"); assertNotNull(inputStream); - SLCommandContext context = new SLCommandContext(); + SLCommandContext context = new SLCommandContext(); + context.setSTAL(stal); SLCommand command = factory.createSLCommand(new StreamSource(inputStream), context); - assertTrue(command instanceof InfoboxReadCommand); + assertTrue(command instanceof InfoboxReadCommand); + + SLResult result = command.execute(); + assertTrue(result instanceof ErrorResult); } } -- cgit v1.2.3