@@ -192,4 +192,33 @@ public void shouldAggregateWithEntity() {
192192 Mockito .verify (manager ).aggregate ("Person" , predicates );
193193 }
194194
195+ @ Test
196+ public void shouldCountByFilterWithCollectionName () {
197+ var filter = eq ("name" , "Poliana" );
198+
199+ template .count ("Person" , filter );
200+
201+ Mockito .verify (manager ).count ("Person" , filter );
202+ }
203+
204+ @ Test
205+ public void shouldCountByFilterWithEntity () {
206+ var filter = eq ("name" , "Poliana" );
207+
208+ template .count (Person .class , filter );
209+
210+ Mockito .verify (manager ).count ("Person" , filter );
211+ }
212+
213+ @ Test
214+ public void shouldReturnErrorOnCountByFilterMethod () {
215+ var filter = eq ("name" , "Poliana" );
216+ assertThrows (NullPointerException .class , () -> template .count ((String ) null , null ));
217+ assertThrows (NullPointerException .class , () -> template .count ((String ) null , filter ));
218+ assertThrows (NullPointerException .class , () -> template .count ("Person" , null ));
219+ assertThrows (NullPointerException .class , () -> template .count ((Class <Person >) null , null ));
220+ assertThrows (NullPointerException .class , () -> template .count ((Class <Person >) null , filter ));
221+ assertThrows (NullPointerException .class , () -> template .count (Person .class , null ));
222+ }
223+
195224}
0 commit comments