Skip to content

Commit

Permalink
fix icon registry test
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskn committed May 10, 2024
1 parent 06c3108 commit 6b257e4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ object IconRegistry {
iconNameToIconUrl[name.lowercase()] = URL(url)
}

internal fun reset() {
iconNameToIconUrl.clear()
iconNameToIconUrl.putAll(commonIcons.mapValues { URL(it.value) })
iconNameToIconUrl.putAll(awsIcons.mapValues { URL(it.value) })
}

/**
* @return True if an icon with the given name (case-insensitive) exists, false otherwise.
*/
Expand Down Expand Up @@ -412,7 +418,6 @@ object IconRegistry {
)

init {
iconNameToIconUrl.putAll(commonIcons.mapValues { URL(it.value) })
iconNameToIconUrl.putAll(awsIcons.mapValues { URL(it.value) })
reset()
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.github.chriskn.structurizrextension.plantuml

import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.AfterEach
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.assertThrows
import java.net.MalformedURLException
Expand Down Expand Up @@ -46,4 +47,9 @@ class IconRegistryTest {
fun `iconFileNameFor return null if no icon file exists for name`() {
assertThat(IconRegistry.iconFileNameFor("iDoNotExist")).isNull()
}

@AfterEach
fun resetIconRegistry() {
IconRegistry.reset()
}
}

0 comments on commit 6b257e4

Please sign in to comment.