Skip to content

Commit

Permalink
refactor(kotlin): migration of the HibernateSearchIndexation to Kotlin
Browse files Browse the repository at this point in the history
  • Loading branch information
davinkevin committed Oct 29, 2018
1 parent 59de549 commit edb8fc9
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 49 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.github.davinkevin.podcastserver.scheduled

import lan.dk.podcastserver.business.ItemBusiness
import org.springframework.scheduling.annotation.Scheduled
import org.springframework.stereotype.Component

/**
* Created by kevin on 22/08/2014.
*/
@Component
class HibernateSearchIndexation(private val itemBusiness: ItemBusiness) {

@Scheduled(fixedDelay = 86400000)
fun refreshIndex() = itemBusiness.reindex()

}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.github.davinkevin.podcastserver.scheduled

import lan.dk.podcastserver.business.ItemBusiness
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.ExtendWith
import org.mockito.InjectMocks
import org.mockito.Mock
import org.mockito.Mockito.times
import org.mockito.Mockito.verify
import org.mockito.junit.jupiter.MockitoExtension

/**
* Created by kevin on 17/08/15 for Podcast Server
*/
@ExtendWith(MockitoExtension::class)
class HibernateSearchIndexationTest {

@Mock lateinit var itemBusiness: ItemBusiness
@InjectMocks lateinit var hibernateSearchIndexation: HibernateSearchIndexation

@Test
fun should_refresh_index() {
/* When */
hibernateSearchIndexation.refreshIndex()
/* Then */
verify(itemBusiness, times(1)).reindex()
}
}

0 comments on commit edb8fc9

Please sign in to comment.