Skip to content

Commit

Permalink
Rename messageReceivedFor(event) -> receivedMessageFor(event)
Browse files Browse the repository at this point in the history
  • Loading branch information
jayohms committed Aug 8, 2023
1 parent 57dddd2 commit 6ece56d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions strada/src/main/kotlin/dev/hotwire/strada/BridgeComponent.kt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ abstract class BridgeComponent<in D : BridgeDestination>(
* reply will be ignored.
*/
protected fun replyTo(event: String): Boolean {
val message = messageReceivedFor(event) ?: run {
val message = receivedMessageFor(event) ?: run {
logEvent("bridgeMessageFailedToReply", "message for event '$event' was not received")
return false
}
Expand All @@ -71,7 +71,7 @@ abstract class BridgeComponent<in D : BridgeDestination>(
* reply will be ignored.
*/
protected fun replyTo(event: String, jsonData: String): Boolean {
val message = messageReceivedFor(event) ?: run {
val message = receivedMessageFor(event) ?: run {
logEvent("bridgeMessageFailedToReply", "message for event '$event' was not received")
return false
}
Expand All @@ -82,7 +82,7 @@ abstract class BridgeComponent<in D : BridgeDestination>(
/**
* Returns the last received message for a given `event`, if available.
*/
protected fun messageReceivedFor(event: String): Message? {
protected fun receivedMessageFor(event: String): Message? {
return receivedMessages[event]
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ class BridgeComponentTest {

@Test
fun didReceive() {
assertNull(component.messageReceivedForPublic("connect"))
assertNull(component.receivedMessageForPublic("connect"))

component.didReceive(message)
assertEquals(message, component.messageReceivedForPublic("connect"))
assertEquals(message, component.receivedMessageForPublic("connect"))
}

@Test
Expand All @@ -55,10 +55,10 @@ class BridgeComponentTest {
val newMessage = message.replacing(jsonData = newJsonData)

component.didReceive(message)
assertEquals(message, component.messageReceivedForPublic("connect"))
assertEquals(message, component.receivedMessageForPublic("connect"))

component.didReceive(newMessage)
assertEquals(newMessage, component.messageReceivedForPublic("connect"))
assertEquals(newMessage, component.receivedMessageForPublic("connect"))
}

@Test
Expand Down
4 changes: 2 additions & 2 deletions strada/src/test/kotlin/dev/hotwire/strada/TestData.kt
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ object TestData {
return replyTo(event, jsonData)
}

fun messageReceivedForPublic(event: String): Message? {
return messageReceivedFor(event)
fun receivedMessageForPublic(event: String): Message? {
return receivedMessageFor(event)
}
}

Expand Down

0 comments on commit 6ece56d

Please sign in to comment.