2 // SqlCommandTest.cs - NUnit Test Cases for testing
3 // System.Data.SqlClient.SqlCommand
6 // Gert Driesen (drieseng@users.sourceforge.net)
8 // Copyright (c) 2007 Gert Driesen
10 // Permission is hereby granted, free of charge, to any person obtaining
11 // a copy of this software and associated documentation files (the
12 // "Software"), to deal in the Software without restriction, including
13 // without limitation the rights to use, copy, modify, merge, publish,
14 // distribute, sublicense, and/or sell copies of the Software, and to
15 // permit persons to whom the Software is furnished to do so, subject to
16 // the following conditions:
18 // The above copyright notice and this permission notice shall be
19 // included in all copies or substantial portions of the Software.
21 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32 using System.Data.Sql;
33 using System.Data.SqlClient;
35 using NUnit.Framework;
37 namespace MonoTests.System.Data.SqlClient
40 public class SqlCommandTest
42 const string COMMAND_TEXT = "SELECT * FROM Authors";
44 [Test] // SqlCommand ()
45 public void Constructor1 ()
47 SqlCommand cmd = new SqlCommand ();
48 Assert.AreEqual (string.Empty, cmd.CommandText, "#1");
49 Assert.AreEqual (30, cmd.CommandTimeout, "#2");
50 Assert.AreEqual (CommandType.Text, cmd.CommandType, "#3");
51 Assert.IsNull (cmd.Connection, "#4");
52 Assert.IsNull (cmd.Container, "#5");
53 Assert.IsTrue (cmd.DesignTimeVisible, "#6");
54 Assert.IsNull (cmd.Notification, "#7");
55 Assert.IsTrue (cmd.NotificationAutoEnlist, "#8");
56 Assert.IsNotNull (cmd.Parameters, "#9");
57 Assert.AreEqual (0, cmd.Parameters.Count, "#10");
58 Assert.IsNull (cmd.Site, "#11");
59 Assert.IsNull (cmd.Transaction, "#11");
60 Assert.AreEqual (UpdateRowSource.Both, cmd.UpdatedRowSource, "#12");
63 [Test] // SqlCommand (string)
64 public void Constructor2 ()
66 SqlCommand cmd = new SqlCommand (COMMAND_TEXT);
67 Assert.AreEqual (COMMAND_TEXT, cmd.CommandText, "#A1");
68 Assert.AreEqual (30, cmd.CommandTimeout, "#A2");
69 Assert.AreEqual (CommandType.Text, cmd.CommandType, "#A3");
70 Assert.IsNull (cmd.Connection, "#A4");
71 Assert.IsNull (cmd.Container, "#A5");
72 Assert.IsTrue (cmd.DesignTimeVisible, "#A6");
73 Assert.IsNull (cmd.Notification, "#A7");
74 Assert.IsTrue (cmd.NotificationAutoEnlist, "#A8");
75 Assert.IsNotNull (cmd.Parameters, "#A9");
76 Assert.AreEqual (0, cmd.Parameters.Count, "#A10");
77 Assert.IsNull (cmd.Site, "#A11");
78 Assert.IsNull (cmd.Transaction, "#A12");
79 Assert.AreEqual (UpdateRowSource.Both, cmd.UpdatedRowSource, "#A13");
81 cmd = new SqlCommand ((string) null);
82 Assert.AreEqual (string.Empty, cmd.CommandText, "#B1");
83 Assert.AreEqual (30, cmd.CommandTimeout, "#B2");
84 Assert.AreEqual (CommandType.Text, cmd.CommandType, "#B3");
85 Assert.IsNull (cmd.Connection, "#B4");
86 Assert.IsNull (cmd.Container, "#B5");
87 Assert.IsTrue (cmd.DesignTimeVisible, "#B6");
88 Assert.IsNull (cmd.Notification, "#B7");
89 Assert.IsTrue (cmd.NotificationAutoEnlist, "#B8");
90 Assert.IsNotNull (cmd.Parameters, "#B9");
91 Assert.AreEqual (0, cmd.Parameters.Count, "#B10");
92 Assert.IsNull (cmd.Site, "#B11");
93 Assert.IsNull (cmd.Transaction, "#B12");
94 Assert.AreEqual (UpdateRowSource.Both, cmd.UpdatedRowSource, "#B13");
97 [Test] // SqlCommand (string, SqlConnection)
98 public void Constructor3 ()
100 SqlConnection conn = new SqlConnection ();
103 cmd = new SqlCommand (COMMAND_TEXT, conn);
104 Assert.AreEqual (COMMAND_TEXT, cmd.CommandText, "#A1");
105 Assert.AreEqual (30, cmd.CommandTimeout, "#A2");
106 Assert.AreEqual (CommandType.Text, cmd.CommandType, "#A3");
107 Assert.AreSame (conn, cmd.Connection, "#A4");
108 Assert.IsNull (cmd.Container, "#A5");
109 Assert.IsTrue (cmd.DesignTimeVisible, "#A6");
110 Assert.IsNull (cmd.Notification, "#A7");
111 Assert.IsTrue (cmd.NotificationAutoEnlist, "#A8");
112 Assert.IsNotNull (cmd.Parameters, "#A9");
113 Assert.AreEqual (0, cmd.Parameters.Count, "#A10");
114 Assert.IsNull (cmd.Site, "#A11");
115 Assert.IsNull (cmd.Transaction, "#A12");
116 Assert.AreEqual (UpdateRowSource.Both, cmd.UpdatedRowSource, "#A13");
118 cmd = new SqlCommand ((string) null, conn);
119 Assert.AreEqual (string.Empty, cmd.CommandText, "#B1");
120 Assert.AreEqual (30, cmd.CommandTimeout, "#B2");
121 Assert.AreEqual (CommandType.Text, cmd.CommandType, "#B3");
122 Assert.AreSame (conn, cmd.Connection, "#B4");
123 Assert.IsNull (cmd.Container, "#B5");
124 Assert.IsTrue (cmd.DesignTimeVisible, "#B6");
125 Assert.IsNull (cmd.Notification, "#B7");
126 Assert.IsTrue (cmd.NotificationAutoEnlist, "#B8");
127 Assert.IsNotNull (cmd.Parameters, "#B9");
128 Assert.AreEqual (0, cmd.Parameters.Count, "#B10");
129 Assert.IsNull (cmd.Site, "#B11");
130 Assert.IsNull (cmd.Transaction, "#B12");
131 Assert.AreEqual (UpdateRowSource.Both, cmd.UpdatedRowSource, "#B13");
133 cmd = new SqlCommand (COMMAND_TEXT, (SqlConnection) null);
134 Assert.AreEqual (COMMAND_TEXT, cmd.CommandText, "#C1");
135 Assert.AreEqual (30, cmd.CommandTimeout, "#C2");
136 Assert.AreEqual (CommandType.Text, cmd.CommandType, "#C3");
137 Assert.IsNull (cmd.Connection, "#C4");
138 Assert.IsNull (cmd.Container, "#C5");
139 Assert.IsTrue (cmd.DesignTimeVisible, "#C6");
140 Assert.IsNull (cmd.Notification, "#C7");
141 Assert.IsTrue (cmd.NotificationAutoEnlist, "#C8");
142 Assert.IsNotNull (cmd.Parameters, "#C9");
143 Assert.AreEqual (0, cmd.Parameters.Count, "#C10");
144 Assert.IsNull (cmd.Site, "#C11");
145 Assert.IsNull (cmd.Transaction, "#C12");
146 Assert.AreEqual (UpdateRowSource.Both, cmd.UpdatedRowSource, "#C13");
149 [Test] // SqlCommand (string, SqlConnection, SqlTransaction)
150 public void Constructor4 ()
152 SqlConnection conn = new SqlConnection ();
155 cmd = new SqlCommand (COMMAND_TEXT, conn, (SqlTransaction) null);
156 Assert.AreEqual (COMMAND_TEXT, cmd.CommandText, "#A1");
157 Assert.AreEqual (30, cmd.CommandTimeout, "#A2");
158 Assert.AreEqual (CommandType.Text, cmd.CommandType, "#A3");
159 Assert.AreSame (conn, cmd.Connection, "#A4");
160 Assert.IsNull (cmd.Container, "#A5");
161 Assert.IsTrue (cmd.DesignTimeVisible, "#A6");
162 Assert.IsNull (cmd.Notification, "#A7");
163 Assert.IsTrue (cmd.NotificationAutoEnlist, "#A8");
164 Assert.IsNotNull (cmd.Parameters, "#A9");
165 Assert.AreEqual (0, cmd.Parameters.Count, "#A10");
166 Assert.IsNull (cmd.Site, "#A11");
167 Assert.IsNull (cmd.Transaction, "#A12");
168 Assert.AreEqual (UpdateRowSource.Both, cmd.UpdatedRowSource, "#A13");
170 cmd = new SqlCommand ((string) null, conn, (SqlTransaction) null);
171 Assert.AreEqual (string.Empty, cmd.CommandText, "#B1");
172 Assert.AreEqual (30, cmd.CommandTimeout, "#B2");
173 Assert.AreEqual (CommandType.Text, cmd.CommandType, "#B3");
174 Assert.AreSame (conn, cmd.Connection, "#B4");
175 Assert.IsNull (cmd.Container, "#B5");
176 Assert.IsTrue (cmd.DesignTimeVisible, "#B6");
177 Assert.IsNull (cmd.Notification, "#B7");
178 Assert.IsTrue (cmd.NotificationAutoEnlist, "#B8");
179 Assert.IsNotNull (cmd.Parameters, "#B9");
180 Assert.AreEqual (0, cmd.Parameters.Count, "#B10");
181 Assert.IsNull (cmd.Site, "#B11");
182 Assert.IsNull (cmd.Transaction, "#B12");
183 Assert.AreEqual (UpdateRowSource.Both, cmd.UpdatedRowSource, "#B13");
185 cmd = new SqlCommand (COMMAND_TEXT, (SqlConnection) null, (SqlTransaction) null);
186 Assert.AreEqual (COMMAND_TEXT, cmd.CommandText, "#C1");
187 Assert.AreEqual (30, cmd.CommandTimeout, "#C2");
188 Assert.AreEqual (CommandType.Text, cmd.CommandType, "#C3");
189 Assert.IsNull (cmd.Connection, "#C4");
190 Assert.IsNull (cmd.Container, "#C5");
191 Assert.IsTrue (cmd.DesignTimeVisible, "#C6");
192 Assert.IsNull (cmd.Notification, "#C7");
193 Assert.IsTrue (cmd.NotificationAutoEnlist, "#C8");
194 Assert.IsNotNull (cmd.Parameters, "#C9");
195 Assert.AreEqual (0, cmd.Parameters.Count, "#C10");
196 Assert.IsNull (cmd.Site, "#C11");
197 Assert.IsNull (cmd.Transaction, "#C12");
198 Assert.AreEqual (UpdateRowSource.Both, cmd.UpdatedRowSource, "#C13");
204 SqlNotificationRequest notificationReq = new SqlNotificationRequest ();
206 SqlCommand cmd = new SqlCommand ();
207 cmd.CommandText = "sp_insert";
208 cmd.CommandTimeout = 100;
209 cmd.CommandType = CommandType.StoredProcedure;
210 cmd.DesignTimeVisible = false;
211 cmd.Notification = notificationReq;
212 cmd.NotificationAutoEnlist = false;
213 cmd.Parameters.Add ("@TestPar1", SqlDbType.Int);
214 cmd.Parameters ["@TestPar1"].Value = DBNull.Value;
215 cmd.Parameters.AddWithValue ("@BirthDate", DateTime.Now);
216 cmd.UpdatedRowSource = UpdateRowSource.OutputParameters;
218 SqlCommand clone = (((ICloneable) (cmd)).Clone ()) as SqlCommand;
219 Assert.AreEqual ("sp_insert", clone.CommandText, "#1");
220 Assert.AreEqual (100, clone.CommandTimeout, "#2");
221 Assert.AreEqual (CommandType.StoredProcedure, clone.CommandType, "#3");
222 Assert.IsNull (cmd.Connection, "#4");
223 Assert.IsFalse (cmd.DesignTimeVisible, "#5");
224 Assert.AreSame (notificationReq, cmd.Notification, "#6");
225 Assert.IsFalse (cmd.NotificationAutoEnlist, "#7");
226 Assert.AreEqual (2, clone.Parameters.Count, "#8");
227 Assert.AreEqual (100, clone.CommandTimeout, "#9");
228 clone.Parameters.AddWithValue ("@test", DateTime.Now);
229 clone.Parameters [0].ParameterName = "@ClonePar1";
230 Assert.AreEqual (3, clone.Parameters.Count, "#10");
231 Assert.AreEqual (2, cmd.Parameters.Count, "#11");
232 Assert.AreEqual ("@ClonePar1", clone.Parameters [0].ParameterName, "#12");
233 Assert.AreEqual ("@TestPar1", cmd.Parameters [0].ParameterName, "#13");
234 Assert.AreEqual ("@BirthDate", clone.Parameters [1].ParameterName, "#14");
235 Assert.AreEqual ("@BirthDate", cmd.Parameters [1].ParameterName, "#15");
236 Assert.IsNull (clone.Transaction, "#16");
240 public void CommandText ()
242 SqlCommand cmd = new SqlCommand ();
243 cmd.CommandText = COMMAND_TEXT;
244 Assert.AreSame (COMMAND_TEXT, cmd.CommandText, "#1");
245 cmd.CommandText = null;
246 Assert.AreEqual (string.Empty, cmd.CommandText, "#2");
247 cmd.CommandText = COMMAND_TEXT;
248 Assert.AreSame (COMMAND_TEXT, cmd.CommandText, "#3");
249 cmd.CommandText = string.Empty;
250 Assert.AreEqual (string.Empty, cmd.CommandText, "#4");
254 public void CommandTimeout ()
256 SqlCommand cmd = new SqlCommand ();
257 cmd.CommandTimeout = 10;
258 Assert.AreEqual (10, cmd.CommandTimeout, "#1");
259 cmd.CommandTimeout = 25;
260 Assert.AreEqual (25, cmd.CommandTimeout, "#2");
261 cmd.CommandTimeout = 0;
262 Assert.AreEqual (0, cmd.CommandTimeout, "#3");
266 public void CommandTimeout_Value_Negative ()
268 SqlCommand cmd = new SqlCommand ();
270 cmd.CommandTimeout = -1;
272 } catch (ArgumentException ex) {
273 // Invalid CommandTimeout value -1; the value must be >= 0
274 Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
275 Assert.IsNull (ex.InnerException, "#3");
276 Assert.IsNotNull (ex.Message, "#4");
277 Assert.AreEqual ("CommandTimeout", ex.ParamName, "#5");
282 public void CommandType_Value_Invalid ()
284 SqlCommand cmd = new SqlCommand ();
286 cmd.CommandType = (CommandType) (666);
288 } catch (ArgumentOutOfRangeException ex) {
289 // The CommandType enumeration value, 666, is invalid
290 Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#2");
291 Assert.IsNull (ex.InnerException, "#3");
292 Assert.IsNotNull (ex.Message, "#4");
293 Assert.IsTrue (ex.Message.IndexOf ("666") != -1, "#5");
294 Assert.AreEqual ("CommandType", ex.ParamName, "#6");
298 [Test] // bug #324386
299 public void Dispose ()
301 string connectionString = "Initial Catalog=a;Server=b;User ID=c;"
303 SqlConnection connection = new SqlConnection (connectionString);
304 SqlCommand command = connection.CreateCommand ();
306 Assert.AreEqual (connectionString, connection.ConnectionString);
310 public void ExecuteNonQuery_Connection_Closed ()
312 string connectionString = "Initial Catalog=a;Server=b;User ID=c;"
314 SqlConnection cn = new SqlConnection (connectionString);
316 SqlCommand cmd = new SqlCommand ("delete from whatever", cn);
318 cmd.ExecuteNonQuery ();
320 } catch (InvalidOperationException ex) {
321 // ExecuteNonQuery requires an open and available
322 // Connection. The connection's current state is
324 Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#2");
325 Assert.IsNull (ex.InnerException, "#3");
326 Assert.IsNotNull (ex.Message, "#4");
327 Assert.IsTrue (ex.Message.IndexOf ("ExecuteNonQuery") != -1, "#5");
332 public void ExecuteNonQuery_Connection_Null ()
334 SqlCommand cmd = new SqlCommand ("delete from whatever");
336 cmd.ExecuteNonQuery ();
338 } catch (InvalidOperationException ex) {
339 // ExecuteNonQuery: Connection property has not
341 Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#2");
342 Assert.IsNull (ex.InnerException, "#3");
343 Assert.IsNotNull (ex.Message, "#4");
344 Assert.IsTrue (ex.Message.StartsWith ("ExecuteNonQuery:"), "#5");
349 public void ExecuteReader_Connection_Closed ()
351 string connectionString = "Initial Catalog=a;Server=b;User ID=c;"
353 SqlConnection cn = new SqlConnection (connectionString);
355 SqlCommand cmd = new SqlCommand ("Select count(*) from whatever", cn);
357 cmd.ExecuteReader ();
359 } catch (InvalidOperationException ex) {
360 // ExecuteReader requires an open and available
361 // Connection. The connection's current state is
363 Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#2");
364 Assert.IsNull (ex.InnerException, "#3");
365 Assert.IsNotNull (ex.Message, "#4");
366 Assert.IsTrue (ex.Message.IndexOf ("ExecuteReader") != -1, "#5");
371 public void ExecuteReader_Connection_Null ()
373 SqlCommand cmd = new SqlCommand ("select * from whatever");
375 cmd.ExecuteReader ();
377 } catch (InvalidOperationException ex) {
378 // ExecuteReader: Connection property has not
380 Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#2");
381 Assert.IsNull (ex.InnerException, "#3");
382 Assert.IsNotNull (ex.Message, "#4");
383 Assert.IsTrue (ex.Message.StartsWith ("ExecuteReader:"), "#5");
388 public void ExecuteScalar_Connection_Closed ()
390 string connectionString = "Initial Catalog=a;Server=b;User ID=c;"
392 SqlConnection cn = new SqlConnection (connectionString);
394 SqlCommand cmd = new SqlCommand ("Select count(*) from whatever", cn);
396 cmd.ExecuteScalar ();
398 } catch (InvalidOperationException ex) {
399 // ExecuteScalar requires an open and available
400 // Connection. The connection's current state is
402 Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#2");
403 Assert.IsNull (ex.InnerException, "#3");
404 Assert.IsNotNull (ex.Message, "#4");
405 Assert.IsTrue (ex.Message.IndexOf ("ExecuteScalar") != -1, "#5");
409 [Test] // bug #412584
410 public void ExecuteScalar_Connection_Null ()
412 SqlCommand cmd = new SqlCommand ("select count(*) from whatever");
414 cmd.ExecuteScalar ();
416 } catch (InvalidOperationException ex) {
417 // ExecuteScalar: Connection property has not
419 Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#2");
420 Assert.IsNull (ex.InnerException, "#3");
421 Assert.IsNotNull (ex.Message, "#4");
422 Assert.IsTrue (ex.Message.StartsWith ("ExecuteScalar:"), "#5");
426 // FIXME: this actually doesn't match .NET behavior. It shouldn't throw NRE.
428 public void Prepare_Connection_Null ()
432 // Text, without parameters
433 cmd = new SqlCommand ("select count(*) from whatever");
437 } catch (NullReferenceException) {
440 // Text, with parameters
441 cmd = new SqlCommand ("select count(*) from whatever");
442 cmd.Parameters.Add ("@TestPar1", SqlDbType.Int);
446 } catch (NullReferenceException) {
449 // Text, without parameters
450 cmd = new SqlCommand ("select count(*) from whatever");
451 cmd.Parameters.Add ("@TestPar1", SqlDbType.Int);
452 cmd.Parameters.Clear ();
456 } catch (NullReferenceException) {
459 // StoredProcedure, without parameters
460 cmd = new SqlCommand ("FindCustomer");
461 cmd.CommandType = CommandType.StoredProcedure;
465 } catch (NullReferenceException) {
468 // StoredProcedure, with parameters
469 cmd = new SqlCommand ("FindCustomer");
470 cmd.CommandType = CommandType.StoredProcedure;
471 cmd.Parameters.Add ("@TestPar1", SqlDbType.Int);
475 } catch (NullReferenceException) {
479 [Test] // bug #412586
480 public void Prepare_Connection_Closed ()
482 string connectionString = "Initial Catalog=a;Server=b;User ID=c;"
484 SqlConnection cn = new SqlConnection (connectionString);
488 // Text, without parameters
489 cmd = new SqlCommand ("select count(*) from whatever", cn);
492 // Text, with parameters
493 cmd = new SqlCommand ("select count(*) from whatever", cn);
494 cmd.Parameters.Add ("@TestPar1", SqlDbType.Int);
498 } catch (InvalidOperationException ex) {
499 // Prepare requires an open and available
500 // Connection. The connection's current state
502 Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#A2");
503 Assert.IsNull (ex.InnerException, "#A3");
504 Assert.IsNotNull (ex.Message, "#A4");
505 Assert.IsTrue (ex.Message.IndexOf ("Prepare") != -1, "#A5");
508 // Text, parameters cleared
509 cmd = new SqlCommand ("select count(*) from whatever", cn);
510 cmd.Parameters.Add ("@TestPar1", SqlDbType.Int);
511 cmd.Parameters.Clear ();
514 // StoredProcedure, without parameters
515 cmd = new SqlCommand ("FindCustomer", cn);
516 cmd.CommandType = CommandType.StoredProcedure;
519 // StoredProcedure, with parameters
520 cmd = new SqlCommand ("FindCustomer", cn);
521 cmd.CommandType = CommandType.StoredProcedure;
522 cmd.Parameters.Add ("@TestPar1", SqlDbType.Int);
525 // ensure connection was not implictly opened
526 Assert.AreEqual (ConnectionState.Closed, cn.State, "#B");
530 public void ResetCommandTimeout ()
532 SqlCommand cmd = new SqlCommand ();
533 cmd.CommandTimeout = 50;
534 Assert.AreEqual (cmd.CommandTimeout, 50, "#1");
535 cmd.ResetCommandTimeout ();
536 Assert.AreEqual (cmd.CommandTimeout, 30, "#2");
540 public void UpdatedRowSource ()
542 SqlCommand cmd = new SqlCommand ();
543 cmd.UpdatedRowSource = UpdateRowSource.None;
544 Assert.AreEqual (UpdateRowSource.None, cmd.UpdatedRowSource, "#1");
545 cmd.UpdatedRowSource = UpdateRowSource.OutputParameters;
546 Assert.AreEqual (UpdateRowSource.OutputParameters, cmd.UpdatedRowSource, "#2");
550 public void UpdatedRowSource_Value_Invalid ()
552 SqlCommand cmd = new SqlCommand ();
554 cmd.UpdatedRowSource = (UpdateRowSource) 666;
556 } catch (ArgumentOutOfRangeException ex) {
557 // The UpdateRowSource enumeration value,666,
559 Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#2");
560 Assert.IsNull (ex.InnerException, "#3");
561 Assert.IsNotNull (ex.Message, "#4");
562 Assert.AreEqual ("UpdateRowSource", ex.ParamName, "#5");
567 [Test] // bug #381100
568 public void ParameterCollectionTest ()
570 SqlCommand cmd = new SqlCommand();
571 cmd.Parameters.AddRange(new SqlParameter[] { });