your profile says you write tests and make them pa...
# announcements
s
your profile says you write tests and make them pass, any better way of testing this rather than the way I already have it?
Copy code
@Test
    fun `AssetCreatedEvent results in event appending with "Asset Created"`() {
        projector.handle(assetCreatedEvent())
        `verify event is added`("Asset Created")
    }

    @Test
    fun `ApplicantUpdatedEvent results in event appending with "Applicant Updated"`() {
        projector.handle(applicantUpdatedEvent())
        `verify event is added`("Applicant Updated")
    }
etc...
    fun `verify event is added`(text: String) {
        verify(repository).save(saveCaptor.capture())

        queue.add(LoanSummaryEvent(text, frozenInstant))
        // we have to save the value because we create a new instance of the queue in the code
        val actual = saveCaptor.value
        assertEquals(loanTransactionId1, actual.loanTransactionId)
        assertTrue(queue.contentEquals(actual.events))
    }