forked from SolaceProducts/solace-spring-cloud
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
only return correlation key from proxy key once
- Loading branch information
Showing
2 changed files
with
48 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...rc/test/java/com/solace/spring/cloud/stream/binder/util/BatchProxyCorrelationKeyTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.solace.spring.cloud.stream.binder.util; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
public class BatchProxyCorrelationKeyTest { | ||
@Test | ||
public void testSuccess() { | ||
Object target = new Object(); | ||
BatchProxyCorrelationKey correlationKey = new BatchProxyCorrelationKey(target, 3); | ||
assertThat(correlationKey.getCorrelationKeyForSuccess()).isNull(); | ||
assertThat(correlationKey.getCorrelationKeyForSuccess()).isNull(); | ||
assertThat(correlationKey.getCorrelationKeyForSuccess()).isEqualTo(target); | ||
|
||
// ensure subsequent calls always returns null | ||
assertThat(correlationKey.getCorrelationKeyForSuccess()).isNull(); | ||
assertThat(correlationKey.getCorrelationKeyForFailure()).isNull(); | ||
} | ||
|
||
@Test | ||
public void testFailed() { | ||
Object target = new Object(); | ||
BatchProxyCorrelationKey correlationKey = new BatchProxyCorrelationKey(target, 3); | ||
assertThat(correlationKey.getCorrelationKeyForSuccess()).isNull(); | ||
assertThat(correlationKey.getCorrelationKeyForFailure()).isEqualTo(target); | ||
|
||
// ensure subsequent calls always returns null | ||
assertThat(correlationKey.getCorrelationKeyForSuccess()).isNull(); | ||
assertThat(correlationKey.getCorrelationKeyForSuccess()).isNull(); | ||
assertThat(correlationKey.getCorrelationKeyForSuccess()).isNull(); | ||
assertThat(correlationKey.getCorrelationKeyForFailure()).isNull(); | ||
} | ||
} |