NameScript { public ScriptChunk getOpValue() { switch(op) { case OP_NAME_FIRSTUPDATE: return args.get(2); case OP_NAME_UPDATE: return args.get(1); default: throw new ScriptException("Not an AnyUpdate op"); } } NameScript(Script baseScript); boolean isNameOp(); Script getAddress(); boolean isAnyUpdate(); ScriptChunk getOpName(); ScriptChunk getOpValue(); static final int OP_NAME_NEW; static final int OP_NAME_FIRSTUPDATE; static final int OP_NAME_UPDATE; }
@Test public void nameFirstUpdateGetOpValue() throws IOException { final NameScript ns = getNameFirstUpdateNameScript(); assertEquals("webpagedeveloper.me/namecoin", new String(ns.getOpValue().data, "ISO-8859-1")); }
@Test public void nameUpdateGetOpValue() throws IOException { final NameScript ns = getNameUpdateNameScript(); assertEquals("{\"info\":{\"registrar\":\"http: }
@Test public void currencyGetOpValue() throws IOException { final NameScript ns = getCurrencyNameScript(); expectedEx.expect(org.bitcoinj.core.ScriptException.class); expectedEx.expectMessage("Not an AnyUpdate op"); ns.getOpValue(); }
@Test public void returnGetOpValue() throws IOException { final NameScript ns = getReturnNameScript(); expectedEx.expect(org.bitcoinj.core.ScriptException.class); expectedEx.expectMessage("Not an AnyUpdate op"); ns.getOpValue(); }
@Test public void nameNewGetOpValue() throws IOException { final NameScript ns = getNameNewNameScript(); expectedEx.expect(org.bitcoinj.core.ScriptException.class); expectedEx.expectMessage("Not an AnyUpdate op"); ns.getOpValue(); }