Spring data jpa repository In-Memory-Testfall
In meinem Projekt habe ich eine Repository-Klasse geschrieben, für die ich eine In-Memory-Testklasse schreiben muss. Mein Repository-Code lautet wie folgt:
package org.jaap.reference.repository;
import java.util.List;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.stereotype.Repository;
import org.jaap.entity.AccountType;
/**
* Repository for type
*
*/
@Repository
public interface AccountTypeRepository
extends JpaRepository<AccountType, Integer>, QueryDslPredicateExecutor<Type> {
/**
* @param AccountTypeCode
* @return List<Type>
*/
@Query("select T from AccountType T where T.AccountTypeCode not in ?# {@environment.getProperty('commit.types').split(',')}")
List<AccountType> findByAccountTypeCodeNotIn();
}
Dazu muss ich Unit-Testfall mit junit schreiben, kann mir mockito jemand helfen?