Skip to content

Instantly share code, notes, and snippets.

class AuthenticationStub(loggedUser: UserId) : AuthenticationHandler {
override fun authenticate(query: Query): Result<ErrorCode, UserId> = loggedUser.asSucces()
}
class InMemoryDraftStorage : Storage {
private val drafts = mutableMapOf<DraftId, Draft>()
override fun save(draft: Draft) {
drafts[draft.id] = draft
}
override fun load(draftId: DraftId): Draft? = drafts[draftId]
}
@Test
fun `when draft is not editable by logged user, returns failure`() {
val authenticationStub = AuthenticationStub(loggedUser = UserId("logged-user"))
val inMemoryDraftStorage = InMemoryDraftStorage()
inMemoryDraftStorage.save(draft.copy(creatorId = UserId("random-user")))
val handler = DraftQueryHandler(
authenticationHandler = authenticationStub,
journalRepository = journalRepositoryStub,
draftTransactor = nullTransactor { inMemoryDraftStorage }
)
@juliabirkett
juliabirkett / pre-commit
Last active March 8, 2021 20:38
Pre-commit hook to find FIXME comments
#!/usr/bin/env bash
diff=$(git diff --cached --name-only -G"//[ ]*(FIXME|DONEXT)")
FOUND="${FOUND}${diff}"
if [ "${FOUND}" != "" ]; then
YELLOW='\033[1;33m'
echo "=========== WARNING =============="
echo "Found FIXME/DONEXT comments in following file(s). Please address them before commiting."
@juliabirkett
juliabirkett / ServiceTest.kt
Last active February 19, 2021 11:35
Example - Attention
class ServiceTest {
@Test
fun `testing the service that receives dependencies injected`() {
val dependency1 = MyDependency()
val dependency2 = AnotherDependency()
val dependency3 = OneMoreDependency()
val dependency4 = OMGAnotherDependency()
val dependency5 = ISwearItsTheLastDependency()
val service = Service(dependency1, dependency2, dependency3, dependency4, dependency5)
@juliabirkett
juliabirkett / PersonTest.kt
Last active February 16, 2021 22:37
Example - DRY ✓ DAMP ✓
class PersonTest {
@Test
fun `returns person full name - Example 4`() {
val person = buildPerson(firstName = "Sandro", lastName = "Marcos")
val fullName = person.fullName()
assertEquals("Sandro Marcos", fullName)
}
@juliabirkett
juliabirkett / PersonTest.kt
Last active February 16, 2021 22:31
Example 2 - DRY ✓ DAMP x
class PersonTest {
private val person: Person = buildPerson()
@Test
fun `returns person full name - Example 3`() {
val fullName = person.fullName()
assertEquals("Johnny Bravo", fullName)
}
@juliabirkett
juliabirkett / PersonTest.kt
Last active February 16, 2021 22:36
Example - DRY ✓ DAMP x
class PersonTest {
@Test
fun `returns person full name - Example 2`() {
val person = buildPerson()
val fullName = person.fullName()
assertEquals("Johnny Bravo", fullName)
}
@juliabirkett
juliabirkett / PersonTest.kt
Last active February 16, 2021 22:30
Example - DRY x DAMP x
class PersonTest {
@Test
fun `returns person full name - Example 1`() {
val person = Person(firstName = "Sandro", lastName = "Marcos", age = 19 /*... all other attributes here */)
val fullName = person.fullName()
assertEquals("Sandro Marcos", fullName)
}

Júlia Marczak Birkett

Hey! My name is Júlia, I was born in 1993 and I learned to code in 2009 at school. I consider myself a Product Engineer because I like to work along product people to build software based on customer's needs. I believe user-centric mindset is what it really means to be Agile (it's not about just attending to ceremonies). I also advocate software good practices, such as Test-Driven Development/Design, domain isolated architectures, Domain-Driven Design, clean code, etc; but without sacrifying simplicity (KISS). Software must be adaptable to changes, but we have to be careful in making assumptions that will overcomplex our solution, because maybe You Ain't Gonna Need It (YAGNI).

Work Experience

  • Software Engineer at Springer Nature.

    in Lisbon/Portugal 🇵🇹 - from Nov/2020 until Oct/2021.