package com.cloudbees.plugins.deployer.casc;

import com.cloudbees.plugins.deployer.DeployNowColumn;
import hudson.model.View;
import io.jenkins.plugins.casc.misc.ConfiguredWithCode;
import io.jenkins.plugins.casc.misc.JenkinsConfiguredWithCodeRule;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;

public class ConfigurationAsCodeTest {
    @Rule
    public JenkinsConfiguredWithCodeRule r = new JenkinsConfiguredWithCodeRule();

    @Test
    @ConfiguredWithCode("view-configuration.yml")
    public void shouldBeAbleToConfigureAView() throws Exception {
        final View view = r.jenkins.getView("view-with-deployNowColumn");
        Assert.assertNotNull(view);

        MatcherAssert.assertThat(view.getColumns(),
              Matchers.hasItem(Matchers.instanceOf(DeployNowColumn.class))
        );
    }
}

@@ -254,32 +254,22 @@
 ort org.
-hamcrest.Matcher
+junit.
 Assert;%0A
@@ -283,25 +283,18 @@
 org.
-hamcrest.Matchers
+junit.Rule
 ;%0Aim
@@ -312,59 +312,51 @@
 nit.
-Asser
+Tes
 t;%0A
+%0A
 import 
-org.junit.Rule;%0Aimport org.junit.Tes
+java.util.stream.StreamSuppor
 t;%0A%0A
@@ -732,23 +732,16 @@
         
-Matcher
 Assert.a
@@ -750,79 +750,160 @@
 ertT
-hat(view.getColumns(),%0A              Matchers.hasItem(Matchers.
+rue(%0A            StreamSupport.stream(view.getColumns().spliterator(), false)%0A                  .anyMatch(%0A                        item -%3E item 
 instance
 Of(D
@@ -902,11 +902,11 @@
 ance
-Of(
+of 
 Depl
@@ -920,15 +920,27 @@
 lumn
-.class)
+%0A                  
 )%0A  

Simplify test code for jcasc support