17
17
*/
18
18
package org .opensearch .ml .memory .action .conversation ;
19
19
20
- import static org .junit .Assert .assertEquals ;
21
-
22
20
import java .io .IOException ;
23
- import java .io .UncheckedIOException ;
24
21
25
- import org .junit .Before ;
26
- import org .junit .Test ;
27
22
import org .opensearch .common .io .stream .BytesStreamOutput ;
28
23
import org .opensearch .common .xcontent .XContentType ;
29
- import org .opensearch .core .action .ActionResponse ;
30
24
import org .opensearch .core .common .bytes .BytesReference ;
31
25
import org .opensearch .core .common .io .stream .BytesStreamInput ;
32
26
import org .opensearch .core .common .io .stream .OutputStreamStreamOutput ;
38
32
39
33
public class CreateConversationResponseTests extends OpenSearchTestCase {
40
34
41
- CreateConversationResponse response ;
42
-
43
- @ Before
44
- public void setup () {
45
- response = new CreateConversationResponse ("test-id" );
46
- }
47
-
48
35
public void testCreateConversationResponseStreaming () throws IOException {
49
36
CreateConversationResponse response = new CreateConversationResponse ("test-id" );
50
37
assert (response .getId ().equals ("test-id" ));
@@ -64,34 +51,4 @@ public void testToXContent() throws IOException {
64
51
String result = BytesReference .bytes (builder ).utf8ToString ();
65
52
assert (result .equals (expected ));
66
53
}
67
-
68
- @ Test
69
- public void fromActionResponseWithCreateConversationResponseSuccess () {
70
- CreateConversationResponse responseFromActionResponse = CreateConversationResponse .fromActionResponse (response );
71
- assertEquals (response .getId (), responseFromActionResponse .getId ());
72
- }
73
-
74
- @ Test
75
- public void fromActionResponseSuccess () {
76
- ActionResponse actionResponse = new ActionResponse () {
77
- @ Override
78
- public void writeTo (StreamOutput out ) throws IOException {
79
- response .writeTo (out );
80
- }
81
- };
82
- CreateConversationResponse responseFromActionResponse = CreateConversationResponse .fromActionResponse (actionResponse );
83
- assertNotSame (response , responseFromActionResponse );
84
- assertEquals (response .getId (), responseFromActionResponse .getId ());
85
- }
86
-
87
- @ Test (expected = UncheckedIOException .class )
88
- public void fromActionResponseIOException () {
89
- ActionResponse actionResponse = new ActionResponse () {
90
- @ Override
91
- public void writeTo (StreamOutput out ) throws IOException {
92
- throw new IOException ();
93
- }
94
- };
95
- CreateConversationResponse .fromActionResponse (actionResponse );
96
- }
97
54
}
0 commit comments