View Javadoc
1   /*
2    * Copyright 2023 Adrian Herscu
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package dev.aherscu.qa.testing.example.scenarios;
18  
19  import static dev.aherscu.qa.jgiven.commons.utils.ConfigurableScenarioTest.*;
20  import static dev.aherscu.qa.testing.utils.StreamMatchers.*;
21  import static org.hamcrest.MatcherAssert.*;
22  import static org.hamcrest.Matchers.*;
23  
24  import java.util.stream.*;
25  
26  import org.testng.annotations.*;
27  
28  import lombok.extern.slf4j.*;
29  
30  @Slf4j
31  public class SelfTests extends AbstractSelfTests {
32      // try here your hamcrest assertions
33  
34      @Test
35      public void shouldMatchEitherString() {
36          assertThat(
37              Stream.of("adf testng", "testng fadf", "Try again", "More results",
38                  "gwrr testngrggr"),
39              allMatch(either(containsStringIgnoringCase("testng"))
40                  .or(containsStringIgnoringCase("More results"))
41                  .or(containsStringIgnoringCase("Try again"))));
42      }
43  
44      @Test(dataProvider = INTERNAL_DATA_PROVIDER)
45      public void shouldRun(final int id) {
46          log.debug("runs with {}", id);
47      }
48  
49      @DataProvider
50      private Object[][] data() {
51          return new Object[][] { { 1 }, { 2 } };
52      }
53  
54  }