Ejemplo n.º 1
0
 public SavePoint() {
   MockFixture mockFixture = TestRun.mockFixture();
   previousTransformedClasses = mockFixture.getTransformedClasses();
   previousRedefinedClasses = mockFixture.getRedefinedClasses();
   previousCaptureTransformerCount = mockFixture.getCaptureTransformerCount();
   previousMockedClasses = mockFixture.getMockedClasses();
   previousMockClasses = TestRun.getMockClasses().new SavePoint();
 }
Ejemplo n.º 2
0
  public synchronized void rollback() {
    if (rollbackActions != null) {
      for (Runnable action : rollbackActions) {
        action.run();
      }
    }

    MockFixture mockFixture = TestRun.mockFixture();
    mockFixture.restoreTransformedClasses(previousTransformedClasses);
    mockFixture.restoreRedefinedClasses(previousRedefinedClasses);
    TestRun.getMockClasses().getRegularMocks().removeInstances(previousMockInstancesCount);
  }
Ejemplo n.º 3
0
  public synchronized void rollback() {
    RECORD_OR_REPLAY_LOCK.lock();

    try {
      MockFixture mockFixture = TestRun.mockFixture();
      mockFixture.removeCaptureTransformers(previousCaptureTransformerCount);
      mockFixture.restoreTransformedClasses(previousTransformedClasses);
      mockFixture.restoreRedefinedClasses(previousRedefinedClasses);
      mockFixture.removeMockedClasses(previousMockedClasses);
      previousMockClasses.rollback();
    } finally {
      RECORD_OR_REPLAY_LOCK.unlock();
    }
  }
Ejemplo n.º 4
0
 public SavePoint() {
   MockFixture mockFixture = TestRun.mockFixture();
   previousTransformedClasses = mockFixture.getTransformedClasses();
   previousRedefinedClasses = mockFixture.getRedefinedClasses();
   previousMockInstancesCount = TestRun.getMockClasses().getRegularMocks().getInstanceCount();
 }