Skip to content

Commit

Permalink
add ESCAPE statement so that test passes with h2 db
Browse files Browse the repository at this point in the history
  • Loading branch information
achimber-moj committed Dec 10, 2024
1 parent e440e73 commit b731653
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT
import org.springframework.test.context.TestPropertySource
import org.springframework.test.web.servlet.MockMvc
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get
import org.springframework.test.web.servlet.result.MockMvcResultMatchers.status
Expand All @@ -17,6 +18,7 @@ import uk.gov.justice.digital.hmpps.test.MockMvcExtensions.withToken

@AutoConfigureMockMvc
@SpringBootTest(webEnvironment = RANDOM_PORT)
@TestPropertySource(properties = ["logging.level.org.hibernate.SQL=DEBUG", "logging.level.org.hibernate.orm.jdbc.bind=TRACE"])
internal class ProbationAreaIntegrationTest {
@Autowired
lateinit var mockMvc: MockMvc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ interface ProbationAreaRepository : JpaRepository<ProbationAreaEntity, Long> {
from District d
join d.borough b
join b.probationArea pa
where pa.description not like 'ZZ%'
and (d.selectable = true or d.code like '%UAT' or d.code like '%UNA' or d.code like '%IAV')
where pa.description not like 'ZZ%' ESCAPE ' '
and (d.selectable = true or d.code like '%UAT' ESCAPE ' ' or d.code like '%UNA' ESCAPE ' ' or d.code like '%IAV' ESCAPE ' ')
and pa.selectable = true
and (pa.establishment is null or pa.establishment <> 'Y')
"""
Expand All @@ -107,8 +107,8 @@ interface ProbationAreaRepository : JpaRepository<ProbationAreaEntity, Long> {
from District d
join d.borough b
join b.probationArea pa
where pa.description not like 'ZZ%'
and (d.selectable = true or d.code like '%UAT' or d.code like '%UNA' or d.code like '%IAV')
where pa.description not like 'ZZ%' ESCAPE ' '
and (d.selectable = true or d.code like '%UAT' ESCAPE ' ' or d.code like '%UNA' ESCAPE ' ' or d.code like '%IAV' ESCAPE ' ')
and (pa.establishment is null or pa.establishment <> 'Y')
"""
)
Expand Down

0 comments on commit b731653

Please sign in to comment.