📄 roundtriptestservicetestcase.java
字号:
2098098.01D, sendByteArray, new Boolean(false), new Byte((byte) 11), new Short((short) 45), new Integer(101), new Long(232309L), new Float(67634.12F), new Double(892387.232D), sendWrapperByteArray); } // testMethodAllTypesIn /** * Test to insure that a primitive byte array matches the expected values on * both the client and server. */ public void testMethodByteArray() throws RemoteException { byte[] expected = {(byte) 5, (byte) 4}; byte[] sendByte = {(byte) 3, (byte) 9}; byte[] actual = binding.methodByteArray(sendByte); assertEquals("The expected and actual values did not match.", expected[0], actual[0]); assertEquals("The expected and actual values did not match.", expected[1], actual[1]); } // testMethodByteArray /** * Test to insure that a Calendar object matches the expected values * on both the client and server. */ public void testMethodDateTime() throws RemoteException { Calendar expected = Calendar.getInstance(); TimeZone gmt = TimeZone.getTimeZone("GMT"); expected.setTimeZone(gmt); expected.setTime(new Date(1012937861800L)); Calendar parameter = Calendar.getInstance(); parameter.setTimeZone(gmt); parameter.setTime(new Date(1012937861996L)); Calendar actual = binding.methodDateTime(parameter); assertEquals("The expected and actual values did not match.", expected, actual); } // testMethodDateTime /** * Just do the same thing that testMethodDateTime does. The REAL * test here is a compile test. Both Calendar and Date map to * xsd:dateTime. The original SEI in this roundtrip test contained * method: "Date methodDate(Date)". But taking that Java -> WSDL -> * Java should result in: "Calendar methodDate(Calendar)". If that * didn't happen, then the compile would fail. */ public void testMethodDate() throws RemoteException { Calendar expected = Calendar.getInstance(); TimeZone gmt = TimeZone.getTimeZone("GMT"); expected.setTimeZone(gmt); expected.setTime(new Date(1012937861800L)); Calendar parameter = Calendar.getInstance(); parameter.setTimeZone(gmt); parameter.setTime(new Date(1012937861996L)); Calendar actual = binding.methodDate(parameter); assertEquals("The expected and actual values did not match.", expected, actual); } // testMethodDate /** * Test to insure that a BigDecimal matches the expected values on * both the client and server. */ public void testMethodBigDecimal() throws RemoteException { BigDecimal expected = new BigDecimal("903483.304"); BigDecimal actual = binding.methodBigDecimal(new BigDecimal("3434.456")); assertEquals("The expected and actual values did not match.", expected, actual); } // testMethodBigDecimal /** * Test to insure that a BigInteger matches the expected values on * both the client and server. */ public void testMethodBigInteger() throws RemoteException { BigInteger expected = new BigInteger("2323"); BigInteger actual = binding.methodBigInteger(new BigInteger("8789")); assertEquals("The expected and actual values did not match.", expected, actual); } // testMethodBigInteger /** * Test to insure that a String matches the expected values on * both the client and server. */ public void testMethodString() throws RemoteException { String expected = "Response"; String actual = binding.methodString(new String("Request")); assertEquals("The expected and actual values did not match.", expected, actual); } // testMethodString /** * Test to insure that a primitive double matches the expected * values on both the client and server. */ public void testMethodDouble() throws RemoteException { double expected = 567.547D; double actual = binding.methodDouble(87502.002D); assertEquals("The expected and actual values did not match.", expected, actual, DOUBLE_DELTA); } // testMethodDouble /** * Test to insure that a primitive float matches the expected * values on both the client and server. */ public void testMethodFloat() throws RemoteException { float expected = 12325.545F; float actual = binding.methodFloat(8787.25F); assertEquals("The expected and actual values did not match.", expected, actual, FLOAT_DELTA); } // testMethodFloat /** * Test to insure that a primitive long matches the expected * values on both the client and server. */ public void testMethodLong() throws RemoteException { long expected = 787985L; long actual = binding.methodLong(45425L); assertEquals("The expected and actual values did not match.", expected, actual); } // testMethodLong /** * Test to insure that a primitive int matches the expected * values on both the client and server. */ public void testMethodInt() throws RemoteException { int expected = 10232; int actual = binding.methodInt(1215); assertEquals("The expected and actual values did not match.", expected, actual); } // testMethodInt /** * Test to insure that a primitive short matches the expected * values on both the client and server. */ public void testMethodShort() throws RemoteException { short expected = (short) 124; short actual = binding.methodShort((short) 302); assertEquals("The expected and actual values did not match.", expected, actual); } // testMethodShort /** * Test to insure that a primitive byte matches the expected * values on both the client and server. */ public void testMethodByte() throws RemoteException { byte expected = (byte) 35; byte actual = binding.methodByte((byte) 61); assertEquals("The expected and actual values did not match.", expected, actual); } // testMethodByte /** * Test to insure that a primitive boolean matches the expected * values on both the client and server. */ public void testMethodBoolean() throws RemoteException { boolean expected = false; boolean actual = binding.methodBoolean(true); assertEquals("The expected and actual values did not match.", expected, actual); } // testMethodBoolean /** * Test to insure that an array of a user defined class matches * the expected values on both the client and server. */ public void testMethodCallOptions() throws RemoteException { CallOptions[] callOptions = new CallOptions[1]; callOptions[0] = new CallOptions(); Calendar cal = Calendar.getInstance(); TimeZone gmt = TimeZone.getTimeZone("GMT"); cal.setTimeZone(gmt); cal.setTime(new Date(1013459984577L)); callOptions[0].setCallDate(cal); CallOptions[] actual = binding.methodCallOptions(callOptions); cal.setTime(new Date(1013459984507L)); assertEquals("The expected and actual values did not match.", cal, actual[0].getCallDate()); } // testMethodCallOptions /** * Test to insure that a wrapper Float object matches * the expected values on both the client and server. */ public void testMethodSoapFloat() throws RemoteException { Float actual = binding.methodSoapFloat(new Float(23423.234F)); assertEquals("The expected and actual values did not match.", new Float(232.23F), actual); } // testMethodSoapFloat /** * Test to insure that a wrapper Double object matches * the expected values on both the client and server. */ public void testMethodSoapDouble() throws RemoteException { Double actual = binding.methodSoapDouble(new Double(123423.234D)); assertEquals("The expected and actual values did not match.", new Double(2232.23D), actual); } // testMethodSoapDouble /** * Test to insure that a wrapper Boolean object matches * the expected values on both the client and server. */ public void testMethodSoapBoolean() throws RemoteException { Boolean actual = binding.methodSoapBoolean(new Boolean(true)); assertEquals("The expected and actual values did not match.", new Boolean(false), actual); } // testMethodSoapBoolean /** * Test to insure that a wrapper Byte object matches * the expected values on both the client and server. */ public void testMethodSoapByte() throws RemoteException { Byte actual = binding.methodSoapByte(new Byte((byte) 9)); assertEquals("The expected and actual values did not match.", new Byte((byte) 10), actual); } // testMethodSoapByte /** * Test to insure that a wrapper Short object matches * the expected values on both the client and server. */ public void testMethodSoapShort() throws RemoteException { Short actual = binding.methodSoapShort(new Short((short) 32)); assertEquals("The expected and actual values did not match.", new Short((short) 44), actual); } // testMethodSoapShort /** * Test to insure that a wrapper Integer object matches * the expected values on both the client and server. */ public void testMethodSoapInt() throws RemoteException { Integer actual = binding.methodSoapInt(new Integer(332)); assertEquals("The expected and actual values did not match.", new Integer(441), actual); } // testMethodSoapInt /** * Test to insure that a wrapper Long object matches * the expected values on both the client and server. */ public void testMethodSoapLong() throws RemoteException { Long actual = binding.methodSoapLong(new Long(3321L)); assertEquals("The expected and actual values did not match.", new Long(4412L), actual); } // testMethodSoapLong /** * Test to insure that a user defined exception can be * thrown and received. */ public void testInvalidTickerSymbol() throws RemoteException { try { binding.throwInvalidTickerException(); fail("Should have received an InvalidTickerSymbol exception."); } catch (InvalidTickerSymbol its) { // Test was successful assertEquals("The expected and actual values did not match.", "ABC", its.getTickerSymbol()); } } // testInvalidTickerSymbol /** * Test to insure that more than one user defined exception can be * defined in a method. */ public void testInvalidTradeExchange() throws RemoteException { try { binding.throwInvalidTradeExchange(); fail("TRY: Should have received an InvalidTradeExchange exception."); } catch (InvalidTradeExchange ite) { // Test was successful assertEquals("The expected and actual values did not match.", "XYZ", ite.getTradeExchange()); } catch (InvalidTickerSymbol its) { fail("ITS: Should have received an InvalidTradeExchange exception."); } catch (InvalidCompanyId ici) { fail("ICI: Should have received an InvalidTradeExchange exception."); } } // testInvalidTradeExchange /** * Make sure holder inout parameters can be round tripped. */ public void testHolderTest() throws RemoteException { StringHolder sh = new StringHolder("hi there"); BondInvestment bi = new BondInvestment(); BondInvestmentHolder bih = new BondInvestmentHolder(bi); binding.holderTest(sh, bih); } // testHolderTest} // End class RoundtripTestServiceTestCase
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -