title: Use Predicate as a Argument for Unit Testing
body: <p>I currently have a function that uses the data type predicate as one of the parameters for the function. See below:</p>
  
  <pre><code>@RequestMapping(method = GET)
  function getAll(WebRequest request, @QuerydslPredicate(root = Image.class) Predicate predicate, @PageableDefault Pageable pageable) {
     return "test"
  }
  </code></pre>
  
  <p>However, I am currently writing Unit test to test the validity of this function, and I'm having a hard time trying to pass a argument for the Predicate into this function so I can test. Can someone please assist?? This is the test function I have so far:</p>
  
  <pre><code> @RunWith(MockitoJUnitRunner.class)
   public class ImageTest {
  
   private Predicate predicate;
  
   @InjectMocks
  ImageController imageController = new ImageController(); 
  
   @Test
  public void testGetAll() throws Exception {
      WebRequest webRequest = mock(WebRequest.class);
  
      ResponseEntity responseEntity = ok(new PagedResponse&lt;&gt;(page));
      when(imageController.getAll(Mockito.eq(webRequest), Mockito.eq(predicate), any(Pageable.class)))
              .thenReturn(responseEntity);
     }
  }
  </code></pre>
  
  <p>In this instance, predicate is null because I'm not sure what to set as the argument</p>