77import static org .mockito .Mockito .when ;
88
99import com .scalar .db .api .DistributedTransactionManager ;
10- import com .scalar .db .common .CoreError ;
1110import com .scalar .db .dataloader .core .FileFormat ;
1211import com .scalar .db .dataloader .core .ScalarDbMode ;
1312import com .scalar .db .dataloader .core .dataimport .ImportMode ;
14- import com .scalar .db .exception .transaction .TransactionException ;
1513import com .scalar .db .service .TransactionFactory ;
1614import java .io .IOException ;
1715import java .nio .file .Files ;
@@ -288,18 +286,14 @@ void call_withoutMaxThreads_shouldDefaultToAvailableProcessors() {
288286 }
289287
290288 @ Test
291- void validateTransactionMode_withInvalidConfig_shouldThrowException () throws Exception {
292- // Arrange - Mock TransactionFactory to throw exception with error
289+ void validateTransactionMode_withUnsupportedOperation_shouldThrowException () throws Exception {
290+ // Arrange - Mock TransactionFactory to throw UnsupportedOperationException
293291 TransactionFactory mockFactory = mock (TransactionFactory .class );
294292 DistributedTransactionManager mockManager = mock (DistributedTransactionManager .class );
295293
296294 when (mockFactory .getTransactionManager ()).thenReturn (mockManager );
297295 when (mockManager .startReadOnly ())
298- .thenThrow (
299- new TransactionException (
300- CoreError .SINGLE_CRUD_OPERATION_TRANSACTION_BEGINNING_TRANSACTION_NOT_ALLOWED
301- .buildMessage (),
302- null ));
296+ .thenThrow (new UnsupportedOperationException ("Transaction mode is not supported" ));
303297
304298 ImportCommand command = new ImportCommand ();
305299 CommandLine cmd = new CommandLine (command );
@@ -312,13 +306,8 @@ void validateTransactionMode_withInvalidConfig_shouldThrowException() throws Exc
312306 CommandLine .ParameterException .class ,
313307 () -> command .validateTransactionMode (mockFactory ));
314308
315- assertTrue (thrown .getMessage ().contains ("does not support TRANSACTION mode" ));
316- assertTrue (
317- thrown
318- .getMessage ()
319- .contains (
320- CoreError .SINGLE_CRUD_OPERATION_TRANSACTION_BEGINNING_TRANSACTION_NOT_ALLOWED
321- .buildCode ()));
309+ assertTrue (thrown .getMessage ().contains ("TRANSACTION mode is not compatible" ));
310+ assertTrue (thrown .getMessage ().contains ("UnsupportedOperationException" ));
322311 }
323312
324313 @ Test
@@ -341,7 +330,7 @@ void validateTransactionMode_withOtherException_shouldThrowException() throws Ex
341330 CommandLine .ParameterException .class ,
342331 () -> command .validateTransactionMode (mockFactory ));
343332
344- assertTrue (thrown .getMessage ().contains ("Failed to validate transaction mode" ));
333+ assertTrue (thrown .getMessage ().contains ("Failed to validate TRANSACTION mode" ));
345334 assertTrue (thrown .getMessage ().contains ("RuntimeException" ));
346335 assertTrue (thrown .getMessage ().contains ("Connection failed" ));
347336 }
0 commit comments