66
66
@ RunWith (MockitoJUnitRunner .class )
67
67
public class JpaQueryMethodUnitTests {
68
68
69
- static final Class <?> DOMAIN_CLASS = User .class ;
70
69
static final String METHOD_NAME = "findByFirstname" ;
71
70
72
71
@ Mock QueryExtractor extractor ;
@@ -328,7 +327,7 @@ public void shouldFindEntityGraphAnnotationOnOverriddenSimpleJpaRepositoryMethod
328
327
doReturn (User .class ).when (metadata ).getDomainType ();
329
328
doReturn (User .class ).when (metadata ).getReturnedDomainClass ((Method ) any ());
330
329
331
- JpaQueryMethod method = new JpaQueryMethod (JpaRepositoryOverride .class .getMethod ("findOne" , Long .class ), metadata ,
330
+ JpaQueryMethod method = new JpaQueryMethod (JpaRepositoryOverride .class .getMethod ("findOne" , Integer .class ), metadata ,
332
331
factory , extractor );
333
332
334
333
assertThat (method .getEntityGraph ()).isNotNull ();
@@ -345,7 +344,7 @@ public void shouldFindEntityGraphAnnotationOnQueryMethodGetOneByWithDerivedName(
345
344
doReturn (User .class ).when (metadata ).getDomainType ();
346
345
doReturn (User .class ).when (metadata ).getReturnedDomainClass ((Method ) any ());
347
346
348
- JpaQueryMethod method = new JpaQueryMethod (JpaRepositoryOverride .class .getMethod ("getOneById" , Long .class ),
347
+ JpaQueryMethod method = new JpaQueryMethod (JpaRepositoryOverride .class .getMethod ("getOneById" , Integer .class ),
349
348
metadata , factory , extractor );
350
349
351
350
assertThat (method .getEntityGraph ()).isNotNull ();
@@ -469,7 +468,7 @@ public void usesAliasedValueForEntityGraph() throws Exception {
469
468
*
470
469
* @author Oliver Gierke
471
470
*/
472
- static interface InvalidRepository extends Repository <User , Long > {
471
+ interface InvalidRepository extends Repository <User , Integer > {
473
472
474
473
// Invalid return type
475
474
User findByFirstname (String firstname , Pageable pageable );
@@ -500,7 +499,7 @@ static interface InvalidRepository extends Repository<User, Long> {
500
499
List <User > findByAnnotatedQuery (@ Param ("param" ) String param );
501
500
}
502
501
503
- static interface ValidRepository extends Repository <User , Long > {
502
+ interface ValidRepository extends Repository <User , Integer > {
504
503
505
504
@ Query (value = "query" , nativeQuery = true )
506
505
List <User > findByLastname (String lastname );
@@ -530,7 +529,7 @@ static interface ValidRepository extends Repository<User, Long> {
530
529
void withMetaAnnotationUsingAliasFor ();
531
530
}
532
531
533
- static interface JpaRepositoryOverride extends JpaRepository <User , Long > {
532
+ interface JpaRepositoryOverride extends JpaRepository <User , Integer > {
534
533
535
534
/**
536
535
* DATAJPA-612
@@ -543,13 +542,13 @@ static interface JpaRepositoryOverride extends JpaRepository<User, Long> {
543
542
* DATAJPA-689
544
543
*/
545
544
@ EntityGraph ("User.detail" )
546
- Optional <User > findOne (Long id );
545
+ Optional <User > findOne (Integer id );
547
546
548
547
/**
549
548
* DATAJPA-696
550
549
*/
551
550
@ EntityGraph
552
- User getOneById (Long id );
551
+ User getOneById (Integer id );
553
552
554
553
@ CustomComposedEntityGraphAnnotationWithAliasFor
555
554
User getOneWithCustomEntityGraphAnnotation ();
0 commit comments