• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2007 Mockito contributors
3  * This program is made available under the terms of the MIT License.
4  */
5 package org.mockitousage.matchers;
6 
7 import static org.mockito.ArgumentMatchers.anyBoolean;
8 import static org.mockito.ArgumentMatchers.anyString;
9 import static org.mockito.Mockito.verify;
10 
11 import org.junit.Ignore;
12 import org.junit.Test;
13 import org.mockito.Mock;
14 import org.mockitousage.IMethods;
15 import org.mockitoutil.TestBase;
16 
17 public class MatchersMixedWithRawArgumentsTest extends TestBase {
18 
19     @Mock private IMethods mock;
20 
21     // description of an idea:
22     // types of arguments and descriptor value that identifies matcher:
23     // Object: objenesis instance to check for identity
24     // boolean: false
25     // byte: max-1
26     // short: max-1
27     // int: max-1
28     // long: max-1
29     // char: 'x'
30     // double: max-1
31     // float: max-1
32 
33     // 1. how objenesis deal with primitive arrays (like byte[])?
34     // 2. Analisys of all matchers used by R2 project finished before any() and so far proves
35     // it's a good idea.
36 
37     @Ignore("prototyping new feature that allows to avoid eq() matchers when raw args passed")
38     @Test
shouldAllowMixingRawArgumentsWithMatchers()39     public void shouldAllowMixingRawArgumentsWithMatchers() {
40         mock.varargs("1", "2", "3");
41         verify(mock).varargs("1", anyString(), "3");
42 
43         verify(mock).varargs(anyBoolean(), false);
44     }
45 }
46