|
1 | 1 | package io.cloudevents.core.impl;
|
2 | 2 |
|
3 | 3 | import static org.assertj.core.api.Assertions.assertThat;
|
4 |
| -import static org.junit.jupiter.api.Assertions.*; |
5 |
| - |
6 |
| -import org.junit.jupiter.api.Test; |
| 4 | +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; |
| 5 | +import static org.junit.jupiter.api.Assertions.assertEquals; |
| 6 | +import static org.junit.jupiter.api.Assertions.assertNotNull; |
| 7 | +import static org.junit.jupiter.api.Assertions.assertThrows; |
| 8 | +import static org.junit.jupiter.api.Assertions.assertTrue; |
7 | 9 |
|
8 | 10 | import io.cloudevents.CloudEvent;
|
9 | 11 | import io.cloudevents.core.builder.CloudEventBuilder;
|
10 | 12 | import io.cloudevents.core.extensions.DistributedTracingExtension;
|
11 | 13 | import io.cloudevents.core.test.Data;
|
| 14 | +import org.junit.jupiter.api.Test; |
12 | 15 |
|
13 | 16 | public class BaseCloudEventBuilderTest {
|
14 | 17 |
|
@@ -48,17 +51,23 @@ public void copyAndRemoveMaterializedExtension() {
|
48 | 51 | }
|
49 | 52 |
|
50 | 53 | @Test
|
51 |
| - public void testLongExtensionName() { |
52 |
| - Exception exception = assertThrows(RuntimeException.class, () -> { |
53 |
| - CloudEvent cloudEvent = CloudEventBuilder.v1(Data.V1_WITH_JSON_DATA_WITH_EXT) |
| 54 | + public void testLongExtensionNameV1() { |
| 55 | + assertDoesNotThrow(() -> { |
| 56 | + CloudEventBuilder.v1(Data.V1_WITH_JSON_DATA_WITH_EXT) |
54 | 57 | .withExtension("thisextensionnameistoolong", "")
|
55 | 58 | .build();
|
56 | 59 | });
|
57 |
| - String expectedMessage = "Invalid extensions name: thisextensionnameistoolong"; |
58 |
| - String actualMessage = exception.getMessage(); |
| 60 | + } |
59 | 61 |
|
60 |
| - assertTrue(actualMessage.contains(expectedMessage)); |
| 62 | + @Test |
| 63 | + public void testLongExtensionNameV03() { |
| 64 | + assertDoesNotThrow(() -> { |
| 65 | + CloudEventBuilder.v03(Data.V1_WITH_JSON_DATA_WITH_EXT) |
| 66 | + .withExtension("thisextensionnameistoolong", "") |
| 67 | + .build(); |
| 68 | + }); |
61 | 69 | }
|
| 70 | + |
62 | 71 | @Test
|
63 | 72 | public void testInvalidExtensionName() {
|
64 | 73 | Exception exception = assertThrows(RuntimeException.class, () -> {
|
|
0 commit comments