Skip to content

Commit

Permalink
PRSD-597: Fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
isobel-softwire committed Jan 8, 2025
1 parent 2761d5b commit 173daab
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import org.springframework.test.web.servlet.get
import org.springframework.web.context.WebApplicationContext
import uk.gov.communities.prsdb.webapp.forms.journeys.PropertyRegistrationJourney
import uk.gov.communities.prsdb.webapp.forms.steps.RegisterPropertyStepId
import uk.gov.communities.prsdb.webapp.services.PropertyOwnershipService

@WebMvcTest(RegisterPropertyController::class)
class RegisterPropertyControllerTests(
Expand All @@ -19,6 +20,9 @@ class RegisterPropertyControllerTests(
@MockBean
lateinit var propertyRegistrationJourney: PropertyRegistrationJourney

@MockBean
lateinit var propertyOwnershipService: PropertyOwnershipService

@BeforeEach
fun setupMocks() {
whenever(propertyRegistrationJourney.initialStepId).thenReturn(RegisterPropertyStepId.PlaceholderPage)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ class PropertyRegistrationServiceTests {
val registeredAddress = AddressDataModel(singleLineAddress = "1 Example Road", uprn = 0L)

val spiedOnPropertyRegistrationService = spy(propertyRegistrationService)
whenever(spiedOnPropertyRegistrationService.getIsAddressRegistered(registeredAddress.uprn!!)).thenReturn(true)
whenever(
spiedOnPropertyRegistrationService.getIsAddressRegistered(registeredAddress.uprn!!, ignoreCache = true),
).thenReturn(true)

val errorThrown =
assertThrows<EntityExistsException> {
Expand Down

0 comments on commit 173daab

Please sign in to comment.