/*
 * Copyright 2017 John L. Jegutanis
 * Copyright 2018 Andreas Schildbach
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.bitcoinj.script;

import com.google.common.collect.Lists;

import org.bitcoinj.core.ECKey;
import org.junit.Test;

import java.math.BigInteger;
import java.util.List;

import static org.junit.Assert.assertTrue;

public class ScriptPatternTest {
    private List<ECKey> keys = Lists.newArrayList(new ECKey(), new ECKey(), new ECKey());

    @Test
    public void testCommonScripts() {
        assertTrue(ScriptPattern.isP2PKH(
                ScriptBuilder.createP2PKHOutputScript(keys.get(0))
        ));
        assertTrue(ScriptPattern.isP2SH(
                ScriptBuilder.createP2SHOutputScript(2, keys)
        ));
        assertTrue(ScriptPattern.isP2PK(
                ScriptBuilder.createP2PKOutputScript(keys.get(0))
        ));
        assertTrue(ScriptPattern.isP2WPKH(
                ScriptBuilder.createP2WPKHOutputScript(keys.get(0))
        ));
        assertTrue(ScriptPattern.isP2WSH(
                ScriptBuilder.createP2WSHOutputScript(new ScriptBuilder().build())
        ));
        assertTrue(ScriptPattern.isSentToMultisig(
                ScriptBuilder.createMultiSigOutputScript(2, keys)
        ));
        assertTrue(ScriptPattern.isSentToCltvPaymentChannel(
                ScriptBuilder.createCLTVPaymentChannelOutput(BigInteger.ONE, keys.get(0), keys.get(1))
        ));
        assertTrue(ScriptPattern.isOpReturn(
                ScriptBuilder.createOpReturnScript(new byte[10])
        ));
    }
}

@@ -69,19 +69,50 @@
 ildbach%0A
+ * Copyright 2019 Tim Strasser%0A
  *%0A
-
  * Licen
@@ -1045,20 +1045,30 @@
 estC
-ommon
+reateP2PKHOutput
 Script
-s
 () %7B
@@ -1181,32 +1181,96 @@
 0))%0A        ));%0A
+    %7D%0A%0A    @Test%0A    public void testCreateP2SHOutputScript() %7B%0A
         assertTr
@@ -1360,32 +1360,96 @@
 ys)%0A        ));%0A
+    %7D%0A%0A    @Test%0A    public void testCreateP2PKOutputScript() %7B%0A
         assertTr
@@ -1543,32 +1543,98 @@
 0))%0A        ));%0A
+    %7D%0A%0A    @Test%0A    public void testCreateP2WPKHOutputScript() %7B%0A
         assertTr
@@ -1732,32 +1732,97 @@
 0))%0A        ));%0A
+    %7D%0A%0A    @Test%0A    public void testCreateP2WSHOutputScript() %7B%0A
         assertTr
@@ -1934,32 +1934,100 @@
 ())%0A        ));%0A
+    %7D%0A%0A    @Test%0A    public void testCreateMultiSigOutputScript() %7B%0A
         assertTr
@@ -2131,32 +2131,104 @@
 ys)%0A        ));%0A
+    %7D%0A%0A    @Test%0A    public void testCreateCLTVPaymentChannelOutput() %7B%0A
         assertTr
@@ -2375,16 +2375,16 @@
 get(1))%0A
-
         
@@ -2383,24 +2383,86 @@
         ));%0A
+    %7D%0A%0A    @Test%0A    public void testCreateOpReturnScript() %7B%0A
         asse

Split testCommonScripts() into smaller tests.