public void testDirectlyEncodeCalendarDateTime() throws Exception { Calendar cal = calendar(2011, 9, 24, 10, 53, 31); String encoded = new XSDateTimeBinding().encode(cal, null); assertEquals("2011-10-24T10:53:31Z", encoded); cal = calendar(2011, 9, 24, 10, 53, 31, 999); encoded = new XSDateTimeBinding().encode(cal, null); assertEquals("2011-10-24T10:53:31.999Z", encoded); }
public void testEncodeCalendarDateTime() throws Exception { Calendar cal; cal = calendar(2011, 9, 24, 10, 53, 31); testEncodeCalendar(cal, TEST.DATETIME, "2011-10-24T10:53:31Z"); cal = calendar(2011, 9, 24, 10, 53, 31, 999); testEncodeCalendar(cal, TEST.DATETIME, "2011-10-24T10:53:31.999Z"); }
public void testNegativeOne() throws Exception { try { validateValues("-1", number("-1")); } catch (IllegalArgumentException e) { // yeah! } }
public void testWithPrefix() throws Exception { QName qName = (QName) binding.parse(null, "foo:bar"); assertNotNull(qName); assertEquals("foo", qName.getPrefix()); assertEquals("http://foo", qName.getNamespaceURI()); assertEquals("bar", qName.getLocalPart()); }
public void testNegativeOne() throws Exception { validateValues("-1", number("-1")); }
public void testUntruth() throws Exception { try { validateValues("TRUE", Boolean.FALSE); fail("TRUTH is not absolute"); } catch (IllegalArgumentException expected) { // yeah! } }
public void testDate() throws Exception { java.sql.Date expected; expected = new java.sql.Date(timestamp(2011, 9, 24)); testParseEncode(XS.DATE, "2011-10-24Z", expected, "2011-10-24Z"); }
public TestConfiguration() { super(new TEST()); addDependency(new XSConfiguration()); } }
public void validateValues(String given, Float expected) throws Exception { Float actual = (Float) strategy.parse(element(given, qname), given); assertEquals(given, expected, actual); }
private String sut2Convert(Date date) throws Exception { return sut2.encode(date, null); } }
public void testSetUp() { assertNotNull("XSD typedef", typeDef); assertNotNull("found anySimpleType", stratagy); }
/** * An instance of a datatype that is defined as ??boolean?? can have the following legal * literals {true, false, 1, 0}. * * @throws Exception */ /* * Test method for 'org.geotools.xs.strategies.XSBooleanStrategy.parse(Element, Node[], Object)' */ public void testTruth() throws Exception { validateValues("true", Boolean.TRUE); validateValues("false", Boolean.FALSE); validateValues("1", Boolean.TRUE); validateValues("0", Boolean.FALSE); }
public void testParse() throws Exception { validateValues("-1E4", new Float(-1E4)); validateValues("1267.43233E12", new Float(1267.43233E12)); validateValues("12.78e-2", new Float(12.78e-2)); validateValues("12", new Float(12)); validateValues("-0", new Float("-0")); validateValues("0", new Float(0)); validateValues("INF", new Float(Float.POSITIVE_INFINITY)); }
/** * integer has a lexical representation consisting of a finite-length sequence of decimal digits * (#x30-#x39) with an optional leading sign. If the sign is omitted, "+" is assumed. * * <p>For example: -1, 0, 12678967543233, +100000. */ public void testParse() throws Exception { validateValues("-1", new BigInteger("-1")); validateValues("0", new BigInteger("0")); validateValues("12678967543233", new BigInteger("12678967543233")); validateValues("+100000", new BigInteger("100000")); }
public void testLargePositiveNumber() throws Exception { try { validateValues("-12678967543233", new BigInteger("-12678967543233")); } catch (IllegalArgumentException expected) { // yeah! } }
private long timestamp(TimeZone timeZone, Integer... values) { Calendar cal = calendar(timeZone, values); return cal.getTimeInMillis(); }
public void testWithNoPrefix() throws Exception { QName qName = (QName) binding.parse(null, "bar:foo"); assertNotNull(qName); assertEquals("bar", qName.getPrefix()); assertEquals("", qName.getNamespaceURI()); assertEquals("foo", qName.getLocalPart()); } }
public void testEncodeCalendarTime() throws Exception { Integer nil = null; Calendar cal; cal = calendar(nil, nil, nil, 10, 53, 31); testEncodeCalendar(cal, TEST.TIME, "10:53:31Z"); cal = calendar(nil, nil, nil, 10, 53, 31, 125); testEncodeCalendar(cal, TEST.TIME, "10:53:31.125Z"); }
public void testZero() throws Exception { validateValues("0", number("0")); }
public void testZero() throws Exception { validateValues("0", number("0")); }