/** * Handles a simple label * * @throws FeathercoinURIParseException If something goes wrong */ @Test public void testGood_Label() throws FeathercoinURIParseException { testObject = new FeathercoinURI( NetworkParameters.prodNet(), FeathercoinURI.LITECOIN_SCHEME + ":" + PRODNET_GOOD_ADDRESS + "?label=Hello%20World"); assertEquals("Hello World", testObject.getLabel()); }
/** * Handles a simple label with an embedded ampersand and plus * * @throws FeathercoinURIParseException If something goes wrong * @throws UnsupportedEncodingException */ @Test public void testGood_LabelWithAmpersandAndPlus() throws FeathercoinURIParseException, UnsupportedEncodingException { String testString = "Hello Earth & Mars + Venus"; String encodedLabel = FeathercoinURI.encodeURLString(testString); testObject = new FeathercoinURI( NetworkParameters.prodNet(), FeathercoinURI.LITECOIN_SCHEME + ":" + PRODNET_GOOD_ADDRESS + "?label=" + encodedLabel); assertEquals(testString, testObject.getLabel()); }
/** * Test the simplest well-formed URI * * @throws FeathercoinURIParseException If something goes wrong */ @Test public void testGood_Simple() throws FeathercoinURIParseException { testObject = new FeathercoinURI( NetworkParameters.prodNet(), FeathercoinURI.LITECOIN_SCHEME + ":" + PRODNET_GOOD_ADDRESS); assertNotNull(testObject); assertNull("Unexpected amount", testObject.getAmount()); assertNull("Unexpected label", testObject.getLabel()); assertEquals("Unexpected label", 20, testObject.getAddress().getHash160().length); }
/** * Handles a Russian label (Unicode test) * * @throws FeathercoinURIParseException If something goes wrong * @throws UnsupportedEncodingException */ @Test public void testGood_LabelWithRussian() throws FeathercoinURIParseException, UnsupportedEncodingException { // Moscow in Russian in Cyrillic String moscowString = "\u041c\u043e\u0441\u043a\u0432\u0430"; String encodedLabel = FeathercoinURI.encodeURLString(moscowString); testObject = new FeathercoinURI( NetworkParameters.prodNet(), FeathercoinURI.LITECOIN_SCHEME + ":" + PRODNET_GOOD_ADDRESS + "?label=" + encodedLabel); assertEquals(moscowString, testObject.getLabel()); }