Class MockLib

java.lang.Object
io.keploy.service.mock.MockLib

public class MockLib extends Object
This is a service class used by Mocking feature. This is the class where Java-sdk communicates with Keploy server to record/store mocks and to perform mocking.
  • Constructor Details

    • MockLib

      public MockLib(String name)
      Initialising Keploy instance and GRPC server
      Parameters:
      name - - App name
  • Method Details

    • NewContext

      public Kcontext NewContext()
      Set the context according to the Keploy mode i.e. if it is in test mode add all the mock data into the context
      Returns:
      - Kcontext
    • StartRecordingMocks

      public static boolean StartRecordingMocks(String path, String mode, String name, Boolean overWrite)
    • GetAllMocks

      public static ArrayList<Service.Mock> GetAllMocks(Service.GetMockReq getMockReq)
      Gets all the mocks in the test mode from the server
      Parameters:
      getMockReq - - contains mock path and app name
      Returns:
      - all the mocks that are recorded
    • PutMock

      public static boolean PutMock(String path, Service.Mock mock)
      Send recorded mocks to the server
      Parameters:
      path - - folder path where mock should be stored
      mock - - mock object
      Returns:
      - Boolean that determines whether mocks are stored or not