List of usage examples for junit.framework AssertionFailedError AssertionFailedError
public AssertionFailedError(String message)
From source file:servletunit.frame2.MockFrame2TestCase.java
/** * Verifies if the ActionServlet controller used this actual path as a * forward./*from www.j a v a 2 s.co m*/ * @param forwardPath an absolute pathname to which the request is to be * forwarded. * @exception AssertionFailedError if the ActionServlet controller used a * different forward path than <code>forwardPath</code> after * executing an Action object. */ public void verifyForwardPath(final String forwardPath) throws AssertionFailedError { confirmSetup(); String fullForwardPath = this.request.getContextPath() + forwardPath; String actualForward = getActualForward(); if (actualForward == null) { throw new AssertionFailedError("Was expecting '" //$NON-NLS-1$ + fullForwardPath + "' but it appears the Action has tried to return an ActionForward that is not mapped correctly."); //$NON-NLS-1$ } if (!(actualForward.equals(fullForwardPath))) throw new AssertionFailedError("was expecting '" + fullForwardPath //$NON-NLS-1$ + "' but received '" + actualForward + "'"); //$NON-NLS-1$ //$NON-NLS-2$ }
From source file:test.functional.TestTCPTransportSample.java
public void doTestStock() throws Exception { try {/*from www. j a v a2 s . c o m*/ log.info("Testing TCP stock service..."); GetQuote tester = new GetQuote(); tester.getQuote(new String[] { "-ltcp://localhost:8088", "XXX" }); String symbol = "XXX"; // args[0] ; EngineConfiguration defaultConfig = (new DefaultEngineConfigurationFactory()).getClientEngineConfig(); SimpleProvider config = new SimpleProvider(defaultConfig); SimpleTargetedChain c = new SimpleTargetedChain(new TCPSender()); config.deployTransport("tcp", c); Service service = new Service(config); Call call = (Call) service.createCall(); call.setTargetEndpointAddress(new URL("tcp://localhost:8088")); call.setOperationName(new QName("urn:xmltoday-delayed-quotes", "getQuote")); call.addParameter("symbol", XMLType.XSD_STRING, ParameterMode.IN); call.setReturnType(XMLType.XSD_FLOAT); Object ret = call.invoke("urn:xmltoday-delayed-quotes", "getQuote", new Object[] { symbol }); if (ret instanceof Float) { Float res = (Float) ret; assertEquals("TestTCPTransportSample: stock price should be 55.25 +/- 0.000001", res.floatValue(), 55.25, 0.000001); } else { throw new AssertionFailedError("Bad return value from TCP stock test: " + ret); } } // } catch (Exception e) { e.printStackTrace(); throw new AssertionFailedError("Fault returned from TCP stock test: " + e); } }
From source file:test.functional.TestTCPTransportSample.java
public void testTCPTransportSample() throws Exception { try {//from w w w . ja v a2 s . c om log.info("Testing TCP transport."); log.info("Testing deployment..."); doTestDeploy(); log.info("OK!"); log.info("Testing service..."); doTestStock(); log.info("OK!"); // Commented out for now, because namespaced-based dispatch for the // TCPListener doesn't work yet. Possible solutions: // 1. Deploy the AdminService at the WSDD namespace's name // 2. Build another dispatch mechanism into the TCP transport // // log.info("Testing undeployment..."); // doTestUndeploy(); // log.info("OK!"); log.info("Test complete."); } catch (Exception e) { e.printStackTrace(); throw new AssertionFailedError("Fault returned from test: " + e); } }
From source file:test.org.osuosl.srw.sort.SortToolTests.java
public void testStringsAscending() { SortTool sorttool = new SortTool(); SortKey sortkey = new SortKey(SORTKEY_STRING); SortKey[] sortKeys = { sortkey }; sorttool.setSortKeys(sortKeys);//from ww w .j av a 2 s . c o m log.info("SortTool: " + sorttool); try { addEntries(sorttool); ArrayList sortedlist = sorttool.getEntries(); assertEquals("Value out of order", "0", ((SortEntry) sortedlist.get(0)).getIdentifier()); assertEquals("Value out of order", "1", ((SortEntry) sortedlist.get(1)).getIdentifier()); assertEquals("Value out of order", "2", ((SortEntry) sortedlist.get(2)).getIdentifier()); assertEquals("Value out of order", "5", ((SortEntry) sortedlist.get(3)).getIdentifier()); assertEquals("Value out of order", "4", ((SortEntry) sortedlist.get(4)).getIdentifier()); assertEquals("Value out of order", "3", ((SortEntry) sortedlist.get(5)).getIdentifier()); } catch (SRWDiagnostic e) { throw new AssertionFailedError(e.toString()); } }
From source file:test.org.osuosl.srw.sort.SortToolTests.java
public void testStringsDescending() { SortTool sorttool = new SortTool(); SortKey sortkey = new SortKey(SORTKEY_STRING); sortkey.setAscending(false);//w w w . ja v a2 s .com SortKey[] sortKeys = { sortkey }; sorttool.setSortKeys(sortKeys); log.info("SortTool: " + sorttool); try { addEntries(sorttool); ArrayList sortedlist = sorttool.getEntries(); assertEquals("Value out of order", "3", ((SortEntry) sortedlist.get(0)).getIdentifier()); assertEquals("Value out of order", "4", ((SortEntry) sortedlist.get(1)).getIdentifier()); assertEquals("Value out of order", "5", ((SortEntry) sortedlist.get(2)).getIdentifier()); assertEquals("Value out of order", "0", ((SortEntry) sortedlist.get(3)).getIdentifier()); assertEquals("Value out of order", "1", ((SortEntry) sortedlist.get(4)).getIdentifier()); assertEquals("Value out of order", "2", ((SortEntry) sortedlist.get(5)).getIdentifier()); } catch (SRWDiagnostic e) { throw new AssertionFailedError(e.toString()); } }
From source file:test.org.osuosl.srw.sort.SortToolTests.java
public void testFloatsAscending() { SortTool sorttool = new SortTool(); SortKey sortkey = new SortKey(SORTKEY_FLOAT); SortKey[] sortKeys = { sortkey }; sorttool.setSortKeys(sortKeys);// www . j ava2 s.co m log.info("SortTool: " + sorttool); try { addEntries(sorttool); ArrayList sortedlist = sorttool.getEntries(); assertEquals("Value out of order", "4", ((SortEntry) sortedlist.get(0)).getIdentifier()); assertEquals("Value out of order", "1", ((SortEntry) sortedlist.get(1)).getIdentifier()); assertEquals("Value out of order", "5", ((SortEntry) sortedlist.get(2)).getIdentifier()); assertEquals("Value out of order", "0", ((SortEntry) sortedlist.get(3)).getIdentifier()); assertEquals("Value out of order", "2", ((SortEntry) sortedlist.get(4)).getIdentifier()); assertEquals("Value out of order", "3", ((SortEntry) sortedlist.get(5)).getIdentifier()); } catch (SRWDiagnostic e) { throw new AssertionFailedError(e.toString()); } }
From source file:test.org.osuosl.srw.sort.SortToolTests.java
public void testFloatsDescending() throws SRWDiagnostic { SortTool sorttool = new SortTool(); SortKey sortkey = new SortKey(SORTKEY_FLOAT); sortkey.setAscending(false);// w w w. j a v a 2 s .co m SortKey[] sortKeys = { sortkey }; sorttool.setSortKeys(sortKeys); log.info("SortTool: " + sorttool); try { addEntries(sorttool); ArrayList sortedlist = sorttool.getEntries(); assertEquals("Value out of order", "2", ((SortEntry) sortedlist.get(0)).getIdentifier()); assertEquals("Value out of order", "3", ((SortEntry) sortedlist.get(1)).getIdentifier()); assertEquals("Value out of order", "0", ((SortEntry) sortedlist.get(2)).getIdentifier()); assertEquals("Value out of order", "5", ((SortEntry) sortedlist.get(3)).getIdentifier()); assertEquals("Value out of order", "1", ((SortEntry) sortedlist.get(4)).getIdentifier()); assertEquals("Value out of order", "4", ((SortEntry) sortedlist.get(5)).getIdentifier()); } catch (SRWDiagnostic e) { throw new AssertionFailedError(e.toString()); } }
From source file:test.org.osuosl.srw.sort.SortToolTests.java
public void testMissingAbortString() { SortTool sorttool = new SortTool(); SortKey sortkey = new SortKey(SORTKEY_STRING); sortkey.setMissingValue(SortKey.MISSINGVALUE_ABORT); SortKey[] sortKeys = { sortkey }; sorttool.setSortKeys(sortKeys);// w w w .j ava 2 s .com log.info("SortTool: " + sorttool); try { for (int i = 0; i < unsortedRecords.length; i++) { String unsortedRecord = unsortedRecords[i]; Record record = new Record(unsortedRecord, null); sorttool.addEntry("" + i, record); } throw new AssertionFailedError("Abort exception was not thrown"); } catch (SRWDiagnostic e) { assertEquals("Abort exception not thrown as expected", SRWDiagnostic.SortEndedDueToMissingValue, e.code); } }
From source file:test.org.osuosl.srw.sort.SortToolTests.java
public void testMissingAbortFloat() { SortTool sorttool = new SortTool(); SortKey sortkey = new SortKey(SORTKEY_FLOAT); sortkey.setMissingValue(SortKey.MISSINGVALUE_ABORT); SortKey[] sortKeys = { sortkey }; sorttool.setSortKeys(sortKeys);//from w w w . j av a 2s . c o m log.info("SortTool: " + sorttool); try { for (int i = 0; i < unsortedRecords.length; i++) { String unsortedRecord = unsortedRecords[i]; Record record = new Record(unsortedRecord, null); sorttool.addEntry("" + i, record); } throw new AssertionFailedError("Abort exception was not thrown"); } catch (SRWDiagnostic e) { assertEquals("Abort exception not thrown as expected", SRWDiagnostic.SortEndedDueToMissingValue, e.code); } }
From source file:test.org.osuosl.srw.sort.SortToolTests.java
public void testMissingHighString() { SortTool sorttool = new SortTool(); SortKey sortkey = new SortKey(SORTKEY_STRING); sortkey.setMissingValue(SortKey.MISSINGVALUE_HIGHVALUE); SortKey[] sortKeys = { sortkey }; sorttool.setSortKeys(sortKeys);/*from w w w . jav a 2 s . c o m*/ log.info("SortTool: " + sorttool); try { addEntries(sorttool); ArrayList sortedlist = sorttool.getEntries(); assertEquals("Value out of order", "0", ((SortEntry) sortedlist.get(0)).getIdentifier()); assertEquals("Value out of order", "1", ((SortEntry) sortedlist.get(1)).getIdentifier()); assertEquals("Value out of order", "2", ((SortEntry) sortedlist.get(2)).getIdentifier()); assertEquals("Value out of order", "5", ((SortEntry) sortedlist.get(3)).getIdentifier()); assertEquals("Value out of order", "4", ((SortEntry) sortedlist.get(4)).getIdentifier()); assertEquals("Value out of order", "3", ((SortEntry) sortedlist.get(5)).getIdentifier()); } catch (SRWDiagnostic e) { throw new AssertionFailedError(e.toString()); } }