Package com.google.common.testing

Examples of com.google.common.testing.TearDown


  public void setUp() {
    driver = createMock(Driver.class);
    ThreadFactory threadFactory = new ThreadFactoryBuilder().setDaemon(true).build();
    executor = Executors.newSingleThreadScheduledExecutor(threadFactory);
    testExecutor = Executors.newCachedThreadPool(threadFactory);
    addTearDown(new TearDown() {
      @Override
      public void tearDown() throws Exception {
        new ExecutorServiceShutdown(executor, Amount.of(1L, Time.SECONDS)).execute();
        new ExecutorServiceShutdown(testExecutor, Amount.of(1L, Time.SECONDS)).execute();
      }
View Full Code Here


  private abstract class RegisteredFixture {
    private final AtomicBoolean runCalled = new AtomicBoolean(false);

    RegisteredFixture() throws Exception {
      // Prevent otherwise silent noop tests that forget to call run().
      addTearDown(new TearDown() {
        @Override
        public void tearDown() {
          assertTrue(runCalled.get());
        }
      });
View Full Code Here

  private Lifecycle lifecycle;

  @Before
  public void mySetUp() throws Exception {
    control = createControl();
    addTearDown(new TearDown() {
      @Override
      public void tearDown() {
        if (mainException.get().isPresent()) {
          RuntimeException e = mainException.get().get();
          LOG.log(Level.SEVERE, "Scheduler main exited with an exception", e);
          fail(e.getMessage());
        }
        control.verify();
      }
    });
    backupDir = FileUtils.createTempDir();
    addTearDown(new TearDown() {
      @Override
      public void tearDown() throws Exception {
        org.apache.commons.io.FileUtils.deleteDirectory(backupDir);
      }
    });
View Full Code Here

          mainException.set(Optional.of(e));
          executor.shutdownNow();
        }
      }
    });
    addTearDown(new TearDown() {
      @Override
      public void tearDown() throws Exception {
        lifecycle.shutdown();
        new ExecutorServiceShutdown(executor, Amount.of(10L, Time.SECONDS)).execute();
      }
View Full Code Here

      public Status answer() throws Throwable {
        testCompleted.await();
        return Status.DRIVER_STOPPED;
      }
    });
    addTearDown(new TearDown() {
      @Override
      public void tearDown() {
        testCompleted.countDown();
      }
    });
View Full Code Here

    expect(schedulers.watch(capture(schedulerWatcher))).andReturn(createMock(Command.class));

    control.replay();

    final ShutdownRegistryImpl shutdownRegistry = injector.getInstance(ShutdownRegistryImpl.class);
    addTearDown(new TearDown() {
      @Override
      public void tearDown() {
        shutdownRegistry.execute();
      }
    });
View Full Code Here

  abstract class StorageTestFixture {
    private final AtomicBoolean runCalled = new AtomicBoolean(false);

    StorageTestFixture() {
      // Prevent otherwise silent noop tests that forget to call run().
      addTearDown(new TearDown() {
        @Override
        public void tearDown() {
          assertTrue(runCalled.get());
        }
      });
View Full Code Here

  private RecoveryImpl recovery;

  @Before
  public void setUp() {
    final File backupDir = FileUtils.createTempDir();
    addTearDown(new TearDown() {
      @Override
      public void tearDown() throws Exception {
        org.apache.commons.io.FileUtils.deleteDirectory(backupDir);
      }
    });
View Full Code Here

  @Before
  public void setUp() {
    delegate = createMock(new Clazz<SnapshotStore<Snapshot>>() { });
    clock = new FakeClock();
    final File backupDir = FileUtils.createTempDir();
    addTearDown(new TearDown() {
      @Override
      public void tearDown() throws Exception {
        org.apache.commons.io.FileUtils.deleteDirectory(backupDir);
      }
    });
View Full Code Here

  @Before
  public void setUp() {
    executor = Executors.newSingleThreadExecutor(
        new ThreadFactoryBuilder().setNameFormat("SlowRead-%d").setDaemon(true).build());
    addTearDown(new TearDown() {
      @Override
      public void tearDown() {
        new ExecutorServiceShutdown(executor, Amount.of(1L, Time.SECONDS)).execute();
      }
    });
View Full Code Here

TOP

Related Classes of com.google.common.testing.TearDown

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.