NameScript { public ScriptChunk getOpName() { switch(op) { case OP_NAME_FIRSTUPDATE: case OP_NAME_UPDATE: return args.get(0); 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 nameFirstUpdateGetOpName() throws IOException { final NameScript ns = getNameFirstUpdateNameScript(); assertEquals("d/bitcoin", new String(ns.getOpName().data, "ISO-8859-1")); }
@Test public void nameUpdateGetOpName() throws IOException { final NameScript ns = getNameUpdateNameScript(); assertEquals("d/bitcoin", new String(ns.getOpName().data, "ISO-8859-1")); }
@Test public void currencyGetOpName() throws IOException { final NameScript ns = getCurrencyNameScript(); expectedEx.expect(org.bitcoinj.core.ScriptException.class); expectedEx.expectMessage("Not an AnyUpdate op"); ns.getOpName(); }
@Test public void returnGetOpName() throws IOException { final NameScript ns = getReturnNameScript(); expectedEx.expect(org.bitcoinj.core.ScriptException.class); expectedEx.expectMessage("Not an AnyUpdate op"); ns.getOpName(); }
@Test public void nameNewGetOpName() throws IOException { final NameScript ns = getNameNewNameScript(); expectedEx.expect(org.bitcoinj.core.ScriptException.class); expectedEx.expectMessage("Not an AnyUpdate op"); ns.getOpName(); }