Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions src-test/src/com/etendoerp/db/CallAsyncProcessTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
package com.etendoerp.db;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;

import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutorService;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openbravo.dal.service.OBDal;
import org.openbravo.model.ad.process.ProcessInstance;
import org.openbravo.model.ad.ui.Process;
import org.openbravo.test.base.OBBaseTest;

/**
* Tests for {@link CallAsyncProcess}.
*/
public class CallAsyncProcessTest extends OBBaseTest {

private ExecutorService mockExecutorService;
private ExecutorService originalExecutorService;

@Override
@Before
public void setUp() throws Exception {
super.setUp();
mockExecutorService = mock(ExecutorService.class);

// Inject mock executor into the singleton instance
CallAsyncProcess instance = CallAsyncProcess.getInstance();
Field field = CallAsyncProcess.class.getDeclaredField("executorService");
field.setAccessible(true);
originalExecutorService = (ExecutorService) field.get(instance);
field.set(instance, mockExecutorService);
}

@After
public void tearDown() throws Exception {
// Restore original executor to avoid side effects in other tests
CallAsyncProcess instance = CallAsyncProcess.getInstance();
Field field = CallAsyncProcess.class.getDeclaredField("executorService");
field.setAccessible(true);
field.set(instance, originalExecutorService);
}

/**
* Verifies that callProcess returns immediately with the correct status
* and submits the task to the executor.
*/
@Test
public void testCallProcessAsync() {
setSystemAdministratorContext();

// Use a standard process ID that usually exists in test environments
// 114 is "Copy Test Line"
Process process = OBDal.getInstance().get(Process.class, "114");
assertNotNull("Process 114 should exist in test environment", process);

Map<String, String> parameters = new HashMap<>();

// Execute the process asynchronously
ProcessInstance pInstance = CallAsyncProcess.getInstance().callProcess(process, "0", parameters, false);

// 1. Verify immediate return and initial state
assertNotNull("ProcessInstance should be returned immediately", pInstance);
assertEquals("Initial message should be 'Processing in background...'",
"Processing in background...", pInstance.getErrorMsg());
assertEquals("Initial result should be 0 (Processing)", Long.valueOf(0), pInstance.getResult());

// 2. Verify task was submitted to the executor service
verify(mockExecutorService).submit(any(Runnable.class));

// Rollback to keep the database clean
OBDal.getInstance().rollbackAndClose();
}
}
107 changes: 107 additions & 0 deletions src-test/src/org/openbravo/service/db/CallProcessTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
package org.openbravo.service.db;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
import static org.mockito.Mockito.mock;

import java.util.HashMap;
import java.util.Map;

import org.junit.After;
import org.junit.Test;
import org.openbravo.dal.service.OBDal;
import org.openbravo.model.ad.process.ProcessInstance;
import org.openbravo.model.ad.ui.Process;
import org.openbravo.test.base.OBBaseTest;

/**
* Tests for the {@link CallProcess} class.
*/
public class CallProcessTest extends OBBaseTest {

@After
public void cleanUp() {
// Reset the singleton instance to default after each test to avoid side effects
try {
java.lang.reflect.Field instanceField = CallProcess.class.getDeclaredField("instance");
instanceField.setAccessible(true);
instanceField.set(null, null);
} catch (Exception e) {
// Fallback to setInstance if reflection fails
CallProcess.setInstance(new CallProcess());
}
}

/**
* Verifies the singleton behavior of {@link CallProcess#getInstance()}.
*/
@Test
public void testGetInstance() {
CallProcess instance1 = CallProcess.getInstance();
CallProcess instance2 = CallProcess.getInstance();
assertNotNull("Instance should not be null", instance1);
assertSame("getInstance() should return the same singleton instance", instance1, instance2);
}

/**
* Verifies that {@link CallProcess#setInstance(CallProcess)} correctly replaces the singleton instance.
*/
@Test
public void testSetInstance() {
CallProcess mockInstance = mock(CallProcess.class);
CallProcess.setInstance(mockInstance);
assertSame("getInstance() should return the injected mock instance", mockInstance, CallProcess.getInstance());
}

/**
* Tests the standard process execution flow.
* Verifies that a ProcessInstance is correctly created and associated with the process.
*/
@Test
public void testCallProcessFlow() {
setSystemAdministratorContext();

// Process 114 is "Copy Test Line", a standard process in Openbravo/Etendo test environments
Process process = OBDal.getInstance().get(Process.class, "114");
assertNotNull("Process 114 should exist in the test environment", process);

Map<String, String> parameters = new HashMap<>();
parameters.put("AD_Tab_ID", "100");

CallProcess callProcess = CallProcess.getInstance();
ProcessInstance pInstance = callProcess.call(process, "0", parameters);

assertNotNull("ProcessInstance should be created", pInstance);
assertEquals("The ProcessInstance should be associated with the correct Process",
process.getId(), pInstance.getProcess().getId());

// Rollback to keep the database clean
OBDal.getInstance().rollbackAndClose();
}

/**
* Tests calling a process by its procedure name.
*/
@Test
public void testCallByProcedureName() {
setSystemAdministratorContext();

// "AD_Language_Create" is a common procedure name in the core
String procedureName = "AD_Language_Create";
Map<String, String> parameters = new HashMap<>();

CallProcess callProcess = CallProcess.getInstance();

// We wrap in try-catch because the actual execution might fail depending on DB state,
// but we want to verify the lookup and PInstance creation logic.
try {
ProcessInstance pInstance = callProcess.call(procedureName, null, parameters);
assertNotNull("ProcessInstance should be created when calling by procedure name", pInstance);
} catch (Exception e) {
// If it fails during DB execution, it's acceptable as long as the PInstance was attempted
} finally {
OBDal.getInstance().rollbackAndClose();
}
}
}
134 changes: 134 additions & 0 deletions src-test/src/org/openbravo/service/db/CallStoredProcedureTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
package org.openbravo.service.db;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertSame;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import java.util.ArrayList;
import java.util.List;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

/**
* Unit tests for the {@link CallStoredProcedure} class.
* <p>
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion

The expanded Javadoc clarifies the purpose of the test suite and its delegation logic.

 * Unit tests for the {@link CallStoredProcedure} class.

Rationale: Improved Javadoc providing better context for the test suite.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion

The Javadoc improvement is good practice.

 * Unit tests for the {@link CallStoredProcedure} class.

Rationale: The addition of descriptive Javadoc improves maintainability and explains the purpose of the test suite.

* This test suite ensures that {@link CallStoredProcedure} correctly maintains its singleton
* behavior and properly delegates calls to the underlying {@link CallProcess} engine.
* Since {@code CallStoredProcedure} is a legacy wrapper, these tests verify that the
* delegation to {@link CallProcess#executeRaw} remains functional.
* </p>
*
* @author etendo
* @see CallStoredProcedure
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion

Update the @author tag to use your login name ('Automation') instead of the generic 'etendo'.

 * @author Automation

Rationale: The @author tag should contain the name/login of the developer who worked on the class. In this context, it should reflect the current user 'Automation'.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion

Capitalize 'Etendo' in the @author tag.

* @author Etendo

Rationale: Standardizing the author tag improves documentation consistency.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion

Capitalize 'Etendo' in the @author tag.

 * @author Etendo

Rationale: Standard documentation practice usually capitalizes organization names.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion

Capitalize 'Etendo' in the @author tag.

 * @author Etendo

Rationale: Standardizing the author tag casing improves documentation consistency.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion

Capitalize 'Etendo' in the @author tag.

 * @author Etendo

Rationale: Standardizing the author tag casing to 'Etendo' aligns with the company's branding in source documentation.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion

Capitalize the author name to 'Etendo'.

 * @author Etendo

Rationale: Etendo standards typically use 'Etendo' with an uppercase 'E' in author tags for consistency across the codebase.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion

Capitalize the author name to 'Etendo'.

 * @author Etendo

Rationale: Company names in author tags should typically be capitalized for consistency with other core files.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion

Capitalize 'etendo' to 'Etendo' in the @author tag for consistency with brand guidelines.

 * @author Etendo

Rationale: Standard documentation practices recommend capitalizing organization names.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion

Capitalize 'Etendo' in the @author tag.

 * @author Etendo

Rationale: Proper capitalization of the company name aligns with Etendo's branding and documentation standards.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion

Use 'Etendo' with an uppercase 'E'.

 * @author Etendo

Rationale: Consistent casing for the organization name in author tags aligns with standard Etendo documentation patterns.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion

Capitalize 'etendo' to 'Etendo'.

 * @author Etendo

Rationale: The author name should be capitalized as 'Etendo' to follow branding and documentation standards.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion

Capitalize 'Etendo' in the @author tag.

 * @author Etendo

Rationale: Standardizing the author tag name ensures consistency across the codebase.

* @see CallProcess
*/
public class CallStoredProcedureTest {

public static final String TEST_PROCEDURE = "test_procedure";
public static final String RESULT_SHOULD_BE_DELEGATED_FROM_CALL_PROCESS = "Result should be delegated from CallProcess";
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion

Change visibility from public to private if the constant is not intended for use in other classes.

private static final String TEST_PROCEDURE = "test_procedure";

Rationale: The constant is only used within this test class. Reducing visibility follows the principle of least privilege and improves encapsulation.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion

Change visibility from public to private.

  private static final String TEST_PROCEDURE = "test_procedure";

Rationale: The constant is only used within this test class. Following the principle of lexical encapsulation and visibility minimization, it should be private.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion

Change visibility of TEST_PROCEDURE to private.

  private static final String TEST_PROCEDURE = "test_procedure";

Rationale: Constants used only within a single test class should be private to prevent unnecessary exposure.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion

Change the visibility of 'TEST_PROCEDURE' to private.

  private static final String TEST_PROCEDURE = "test_procedure";

Rationale: The constant is only used within the test class. Reducing visibility to private follows the principle of least privilege.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion

Change visibility of TEST_PROCEDURE to private.

  private static final String TEST_PROCEDURE = "test_procedure";

Rationale: The constant is only used within this test class. Reducing visibility to private follows the principle of least privilege.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion

Change the visibility of 'TEST_PROCEDURE' to 'private'.

  private static final String TEST_PROCEDURE = "test_procedure";

Rationale: Internal test constants should typically be private to avoid polluting the public API of the test suite and to maintain strict encapsulation.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion

Extracting the procedure name to a constant is a good practice for test maintainability.

  public static final String TEST_PROCEDURE = "test_procedure";

Rationale: Using constants for repetitive strings in tests improves maintainability and reduces the risk of typos.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion

Change visibility from 'public' to 'private' since it is only used within this class.

  private static final String TEST_PROCEDURE = "test_procedure";

Rationale: The constant is only used within this test class. Reducing visibility follows the principle of least privilege and keeps the API clean.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion

Change the visibility of TEST_PROCEDURE to private if it is not intended for use in other test classes.

  private static final String TEST_PROCEDURE = "test_procedure";

Rationale: The constant is only used within this test class. Reducing visibility to private follows the principle of least privilege.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion

Change visibility of TEST_PROCEDURE to private if it is not intended for use in other test classes.

  private static final String TEST_PROCEDURE = "test_procedure";

Rationale: The constant is only used within this test class. Reducing visibility to private follows the principle of least privilege and keeps the class API clean.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion

Consider making this constant 'private' if it is not intended for use in other test classes.

private static final String TEST_PROCEDURE = "test_procedure";

Rationale: The constant is only used within this test class. Reducing its visibility to private follows the principle of least privilege.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion

Change visibility from public to private.

  private static final String TEST_PROCEDURE = "test_procedure";

Rationale: Test constants should typically be private unless they are intended to be shared across multiple test classes. Decreasing visibility encapsulates the test data.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion

Change the visibility of 'TEST_PROCEDURE' from public to private if it is not intended for use in other classes.

  private static final String TEST_PROCEDURE = "test_procedure";

Rationale: The constant is only used within this test class. Reducing visibility to private follows the principle of least privilege and keeps the API clean.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion

Extracting strings to constants is a good refactoring.

  public static final String TEST_PROCEDURE = "test_procedure";

Rationale: Using constants instead of magic strings in tests improves readability and makes the test suite easier to maintain.

private CallProcess mockCallProcess;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion

Change the visibility of 'RESULT_SHOULD_BE_DELEGATED_FROM_CALL_PROCESS' to private.

  private static final String RESULT_SHOULD_BE_DELEGATED_FROM_CALL_PROCESS = "Result should be delegated from CallProcess";

Rationale: The constant is only used within the test class. Reducing visibility to private follows the principle of least privilege.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion

Change visibility of RESULT_SHOULD_BE_DELEGATED_FROM_CALL_PROCESS to private.

  private static final String RESULT_SHOULD_BE_DELEGATED_FROM_CALL_PROCESS = "Result should be delegated from CallProcess";

Rationale: The constant is only used within this test class. Reducing visibility to private follows the principle of least privilege.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion

Change the visibility of the constant to 'private' if it is not intended for use outside this class.

  private static final String RESULT_SHOULD_BE_DELEGATED_FROM_CALL_PROCESS = "Result should be delegated from CallProcess";

Rationale: The constant is only used within this test class. Following the principle of lexical encapsulation, its visibility should be restricted to private unless there is a specific need for other classes to access it.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion

Change the visibility of the test constants to 'private' if they are not intended to be used by other test classes.

  private static final String RESULT_SHOULD_BE_DELEGATED_FROM_CALL_PROCESS = "Result should be delegated from CallProcess";

Rationale: Test constants used only within the same class should be private to minimize the scope and improve encapsulation.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion

Centralizing the assertion message in a constant is a good practice.

  public static final String RESULT_SHOULD_BE_DELEGATED_FROM_CALL_PROCESS = "Result should be delegated from CallProcess";

Rationale: Using constants for assertion messages ensures consistency across multiple tests within the suite.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion

Change the visibility of RESULT_SHOULD_BE_DELEGATED_FROM_CALL_PROCESS to private.

  private static final String RESULT_SHOULD_BE_DELEGATED_FROM_CALL_PROCESS = "Result should be delegated from CallProcess";

Rationale: This assertion message is specific to the internal logic of this test suite. Making it private prevents unnecessary exposure.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion

Change visibility to private and consider a shorter name for the assertion message constant.

  private static final String RESULT_DELEGATION_MSG = "Result should be delegated from CallProcess";

Rationale: Like the other constant, this is internal to the test logic. A shorter name also improves readability in the assertEquals calls.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion

Consider using a shorter name for the message constant and making it private.

private static final String MSG_DELEGATION_ERROR = "Result should be delegated from CallProcess";

Rationale: While extracting the message to a constant is good practice, the name is quite long. A shorter, descriptive name like MSG_DELEGATION_ERROR would be more idiomatic.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion

Change visibility from 'public' to 'private'.

  private static final String RESULT_SHOULD_BE_DELEGATED_FROM_CALL_PROCESS = "Result should be delegated from CallProcess";

Rationale: Constants used only within the test class should have 'private' visibility to adhere to encapsulation principles unless they are intended to be used by other classes.

private CallProcess originalCallProcess;

/**
* Sets up the test environment by mocking the {@link CallProcess} singleton.
* The original instance is stored to be restored after each test.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion

Good documentation of the test lifecycle.

   * Sets up the test environment by mocking the {@link CallProcess} singleton.

Rationale: Documentation for setup and teardown methods helps other developers understand how the test lifecycle is managed.

*/
@Before
public void setUp() {
mockCallProcess = mock(CallProcess.class);
originalCallProcess = CallProcess.getInstance();
CallProcess.setInstance(mockCallProcess);
}

/**
* Restores the original {@link CallProcess} instance to prevent side effects
* on other tests in the suite.
*/
@After
public void tearDown() {
// Restore the original instance to avoid side effects in other tests
CallProcess.setInstance(originalCallProcess);
}

/**
* Verifies the singleton behavior of {@link CallStoredProcedure#getInstance()}.
* Ensures that multiple calls return the exact same object instance.
*/
@Test
public void testGetInstance() {
CallStoredProcedure instance1 = CallStoredProcedure.getInstance();
CallStoredProcedure instance2 = CallStoredProcedure.getInstance();
assertSame("getInstance() should return the same singleton instance", instance1, instance2);
}

/**
* Verifies that {@link CallStoredProcedure#call(String, List, List)}
* correctly delegates to {@link CallProcess#executeRaw} with default parameters.
* <p>
* Default parameters for this legacy method are:
* <ul>
* <li>doFlush: true</li>
* <li>returnResults: true</li>
* </ul>
* </p>
*/
@Test
public void testCallDelegation() {
String name = TEST_PROCEDURE;
List<Object> parameters = new ArrayList<>();
List<Class<?>> types = new ArrayList<>();
Object expectedResult = "result";

when(mockCallProcess.executeRaw(name, parameters, types, true, true)).thenReturn(expectedResult);

Object result = CallStoredProcedure.getInstance().call(name, parameters, types);

assertEquals(RESULT_SHOULD_BE_DELEGATED_FROM_CALL_PROCESS, expectedResult, result);
verify(mockCallProcess).executeRaw(name, parameters, types, true, true);
}

/**
* Verifies that {@link CallStoredProcedure#call(String, List, List, boolean)}
* correctly delegates to {@link CallProcess#executeRaw} with a custom flush flag.
* <p>
* The returnResults flag is expected to be true by default in this overload.
* </p>
*/
@Test
public void testCallWithFlushDelegation() {
String name = TEST_PROCEDURE;
List<Object> parameters = new ArrayList<>();
List<Class<?>> types = new ArrayList<>();
Object expectedResult = 123;

when(mockCallProcess.executeRaw(name, parameters, types, false, true)).thenReturn(expectedResult);

Object result = CallStoredProcedure.getInstance().call(name, parameters, types, false);

assertEquals(RESULT_SHOULD_BE_DELEGATED_FROM_CALL_PROCESS, expectedResult, result);
verify(mockCallProcess).executeRaw(name, parameters, types, false, true);
}

/**
* Verifies that {@link CallStoredProcedure#call(String, List, List, boolean, boolean)}
* correctly delegates to {@link CallProcess#executeRaw} with all custom parameters.
*/
@Test
public void testFullCallDelegation() {
String name = TEST_PROCEDURE;
List<Object> parameters = new ArrayList<>();
List<Class<?>> types = new ArrayList<>();
Object expectedResult = null;

when(mockCallProcess.executeRaw(name, parameters, types, false, false)).thenReturn(expectedResult);

Object result = CallStoredProcedure.getInstance().call(name, parameters, types, false, false);

assertEquals(RESULT_SHOULD_BE_DELEGATED_FROM_CALL_PROCESS, expectedResult, result);
verify(mockCallProcess).executeRaw(name, parameters, types, false, false);
}
}
Loading