title: How to mock PanacheQuery<Entity> using Quarkus with Hibernate-OMR PanacheRepository
body: <p>I am using Quarkus with Hibernate-ORM PanacheRepository and I need to mock the PanacheQuery.
  I have the following classes:</p>
  <ul>
  <li>Label(JPA Entity)</li>
  <li>LabelRepository (implements PanacheRepository&lt; Label &gt; {})</li>
  </ul>
  <p>In my test class I need to mock the <strong>labelRepository.find(&quot;name&quot;, name)</strong>. This method return a  PanacheQuery but I don't know how I can create a new PanacheQuery mock.</p>
  <pre><code>@QuarkusTest
  class LabelResourceTest {
  
    @Inject LabelResource labelResource;
    @InjectMock LabelRepository labelRepository;
  
    private Label label;
    private List&lt;Label&gt; labels;
  
    @BeforeEach
    void setUp() {
      label = new Label();
      label.setId(1L);
      label.setName(&quot;LABEL#01&quot;);
      label.setInheritable(true);
  
      labels = new ArrayList&lt;&gt;();
      labels.add(label);
    }
  
   @Test
   void getNameTest() {
    when(labelRepository.find(&quot;name&quot;, &quot;LABEL#01&quot;)).thenReturn(......);
  
   .....
  
   }
  }
  </code></pre>
  <p>Thank you.</p>