• 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 
6 package org.mockitousage.matchers;
7 
8 import org.junit.Ignore;
9 import org.junit.Test;
10 import org.mockito.Mock;
11 import org.mockitousage.IMethods;
12 import org.mockitoutil.TestBase;
13 
14 import static org.mockito.Matchers.anyBoolean;
15 import static org.mockito.Matchers.anyString;
16 import static org.mockito.Mockito.verify;
17 
18 public class MatchersMixedWithRawArgumentsTest extends TestBase {
19 
20     @Mock private IMethods mock;
21 
22     //description of an idea:
23     //types of arguments and descriptor value that identifies matcher:
24     //Object: objenesis instance to check for identity
25     //boolean: false
26     //byte: max-1
27     //short: max-1
28     //int: max-1
29     //long: max-1
30     //char: 'x'
31     //double: max-1
32     //float: max-1
33 
34     //1. how objenesis deal with primitive arrays (like byte[])?
35     //2. Analisys of all matchers used by R2 project finished before anyObject() and so far proves 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