### Question:
LocalDhisResourceRepositoryTemplate { public boolean deleteById( @Nonnull String id, @Nonnull Function<String, T> prototypeFunction ) { final RequestCacheContext context = requestCacheService.getCurrentRequestCacheContext(); final Optional<LocalDhisResourceRepository<T>> repository = getRepository( context ); return repository.map( tLocalDhisResourceRepository -> tLocalDhisResourceRepository.deleteById( id, getResourceKey( context ), prototypeFunction ) ) .orElseGet( () -> persistCallback.persistDeleteById( id ) ); } LocalDhisResourceRepositoryTemplate( @Nonnull Class<T> resourceClass, @Nonnull RequestCacheService requestCacheService,
        @Nonnull LocalDhisRepositoryPersistCallback<T> persistCallback ); @Nonnull T save( @Nonnull T resource ); @Nonnull T save( @Nonnull T resource, @Nullable Consumer<T> localResourceConsumer ); boolean deleteById( @Nonnull String id, @Nonnull Function<String, T> prototypeFunction ); @Nonnull Optional<T> findOneById( @Nonnull String id, @Nonnull Function<String, T> callback ); boolean isLocal( @Nonnull String id ); @Nonnull Collection<T> find( @Nonnull Predicate<T> filter, @Nonnull Supplier<Collection<T>> collectionSupplier, boolean localOnly, @Nonnull String methodName, @Nonnull Object... args ); @Nonnull Collection<T> find( @Nullable String trackedEntityInstanceId, @Nonnull Predicate<T> filter, @Nonnull Supplier<Collection<T>> collectionSupplier, boolean localOnly, @Nonnull String methodName, @Nonnull Object... args ); static final String CONTAINER_REQUEST_CACHE_ATTRIBUTE_NAME; static final String RESOURCE_KEY_REQUEST_CACHE_ATTRIBUTE_NAME; }### Answer:
@Test public void deleteByIdNoLocal() { final TrackedEntityInstance tei = new TrackedEntityInstance(); Mockito.doReturn( true ).when( persistCallback ).persistDeleteById( Mockito.eq( "h1234567890" ) ); Assert.assertTrue( template.deleteById( "h1234567890", TrackedEntityInstance::new ) ); Mockito.verify( persistCallback ).persistDeleteById( Mockito.eq( "h1234567890" ) ); }