当前位置: 首页>>代码示例>>Java>>正文


Java StoppedByUserException类代码示例

本文整理汇总了Java中org.junit.runner.notification.StoppedByUserException的典型用法代码示例。如果您正苦于以下问题:Java StoppedByUserException类的具体用法?Java StoppedByUserException怎么用?Java StoppedByUserException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


StoppedByUserException类属于org.junit.runner.notification包,在下文中一共展示了StoppedByUserException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fireTestStarted

import org.junit.runner.notification.StoppedByUserException; //导入依赖的package包/类
@Override
public void fireTestStarted(Description description) throws StoppedByUserException {
  super.fireTestStarted(description);
  String message = "Running " + description.getDisplayName();
  logger.info(message);

  try {
    EntityPlayerMP player = server.getPlayerList().getPlayerByUsername(playerName);
    ITextComponent itextcomponent = new TextComponentString(message);
    SPacketTitle packet = new SPacketTitle(SPacketTitle.Type.ACTIONBAR,
        TextComponentUtils.processComponent(player, itextcomponent, player));
    player.connection.sendPacket(packet);
  } catch (CommandException e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:wizards-of-lua,项目名称:wizards-of-lua,代码行数:17,代码来源:TestResults.java

示例2: run

import org.junit.runner.notification.StoppedByUserException; //导入依赖的package包/类
@Override
public void run(RunNotifier notifier) {
  currentNotifier = new ThreadSafeRunNotifier(notifier);
  if (cancelRequested) {
    currentNotifier.pleaseStop();
  }

  try {
    delegate.run(currentNotifier);
  } catch (StoppedByUserException e) {
    if (cancelRequested) {
      throw new RuntimeException("Test run interrupted", e);
    }
    throw e;
  }
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:17,代码来源:CancellableRequestFactory.java

示例3: testCancelRunBeforeStarting

import org.junit.runner.notification.StoppedByUserException; //导入依赖的package包/类
@Test
public void testCancelRunBeforeStarting() throws Exception {
  final AtomicBoolean testRan = new AtomicBoolean(false);

  // A runner that should never run its test
  FakeRunner runner = new FakeRunner("shouldNotRun", new Runnable() {
    @Override
    public void run() {
      testRan.set(true);
    }
  });

  Request request = cancellableRequestFactory.createRequest(Request.runner(runner));
  cancellableRequestFactory.cancelRun();
  JUnitCore core = new JUnitCore();

  try {
    core.run(request);
    fail("exception expected");
  } catch (RuntimeException e) {
    assertThat(e).hasMessageThat().isEqualTo("Test run interrupted");
    assertThat(e).hasCauseThat().isInstanceOf(StoppedByUserException.class);
  }

  assertThat(testRan.get()).isFalse();
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:27,代码来源:CancellableRequestFactoryTest.java

示例4: doRunTest

import org.junit.runner.notification.StoppedByUserException; //导入依赖的package包/类
private void doRunTest(Test testSuite) {
    mode = Mode.RUNNING;
    resetToolBar();
    startTime = System.currentTimeMillis();
    runnerThread = new Thread("TestRunner-Thread") {
        @Override public void run() {
            try {
                runner = new MarathonTestRunner();
                runner.addListener(runListener);
                runner.addListener(new AllureMarathonRunListener());
                @SuppressWarnings("unused")
                Result result = runner.run(testSuite);
                runFinished(testSuite);
            } catch (StoppedByUserException e) {
                abort();
            } finally {
                // always return control to UI
                if (interrupted()) {
                    abort();
                }
                MarathonTestCase.reset();
                runnerThread = null;
                System.gc();
            }
        }

        private void abort() {
            endTime = System.currentTimeMillis();
            Platform.runLater(() -> status.setText("Aborted after " + (endTime - startTime) / 1000 + " seconds"));
            mode = Mode.RESULTS;
            resetToolBar();
        }

    };
    createTestReportDir();
    runnerThread.start();
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:38,代码来源:TestRunner.java

示例5: executeTestSet

import org.junit.runner.notification.StoppedByUserException; //导入依赖的package包/类
private void executeTestSet( Class<?> clazz, RunListener reporter, Notifier notifier )
{
    final ReportEntry report = new SimpleReportEntry( getClass().getName(), clazz.getName() );
    reporter.testSetStarting( report );
    try
    {
        executeWithRerun( clazz, notifier );
    }
    catch ( Throwable e )
    {
        if ( isFailFast() && e instanceof StoppedByUserException )
        {
            String reason = e.getClass().getName();
            Description skippedTest = createDescription( clazz.getName(), createIgnored( reason ) );
            notifier.fireTestIgnored( skippedTest );
        }
        else
        {
            String reportName = report.getName();
            String reportSourceName = report.getSourceName();
            PojoStackTraceWriter stackWriter = new PojoStackTraceWriter( reportSourceName, reportName, e );
            reporter.testError( withException( reportSourceName, reportName, stackWriter ) );
        }
    }
    finally
    {
        reporter.testSetCompleted( report );
    }
}
 
开发者ID:play1-maven-plugin,项目名称:play1-maven-plugin,代码行数:30,代码来源:PlayJUnit4Provider.java

示例6: fireTestStarted

import org.junit.runner.notification.StoppedByUserException; //导入依赖的package包/类
@Override
public void fireTestStarted(final Description description) throws StoppedByUserException {
  if (pleaseStop) {
    throw new StoppedByUserException();
  }
  new SafeNotifier() {
    @Override
    protected void notifyListener(RunListener each) throws Exception {
      each.testStarted(description);
    }
  }.run();
}
 
开发者ID:Kurento,项目名称:kurento-java,代码行数:13,代码来源:KurentoRunNotifier.java

示例7: testStarted

import org.junit.runner.notification.StoppedByUserException; //导入依赖的package包/类
@Override
public void testStarted(final Description description) throws Exception {
  if (this.failed) {
    // If the JUnit test has been annotated with @BeforeClass or @AfterClass
    // need to force the exit after the first failure as tests will be run as
    // a block
    // rather than individually.
    // This is apparently the junit way.
    throw new StoppedByUserException();
  }
  this.rc.notifyStart(this.description);
}
 
开发者ID:hcoles,项目名称:pitest,代码行数:13,代码来源:AdaptingRunListener.java

示例8: fireTestStarted

import org.junit.runner.notification.StoppedByUserException; //导入依赖的package包/类
/**
 * {@inheritDoc}<p>
 *
 * The implementation is almost an exact copy of the version in
 * {@code RunNotifier} but is thread-safe.
 */
@Override
public void fireTestStarted(Description description) throws StoppedByUserException {
  if (stopRequested) {
    throw new StoppedByUserException();
  }
  getDelegate().fireTestStarted(description);
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:14,代码来源:CancellableRequestFactory.java

示例9: testInterruptedTest

import org.junit.runner.notification.StoppedByUserException; //导入依赖的package包/类
@Test
public void testInterruptedTest() throws Exception {
  config = createConfig();
  mockRunListener = mock(RunListener.class);
  JUnit4BazelMock component = createComponent(SampleSuite.class);
  JUnit4Runner runner = component.runner();
  final CancellableRequestFactory requestFactory = component.cancellableRequestFactory();

  Description testDescription = Description.createTestDescription(SamplePassingTest.class,
      "testThatAlwaysPasses");

  doAnswer(cancelTestRun(requestFactory))
      .when(mockRunListener).testStarted(testDescription);

  try {
    runner.run();
    fail("exception expected");
  } catch (RuntimeException e) {
    assertThat(e).hasMessageThat().isEqualTo("Test run interrupted");
    assertWithMessage("Expected cause to be a StoppedByUserException")
        .that(e.getCause() instanceof StoppedByUserException)
        .isTrue();

    InOrder inOrder = inOrder(mockRunListener);
    inOrder.verify(mockRunListener).testRunStarted(any(Description.class));
    inOrder.verify(mockRunListener).testStarted(testDescription);
    inOrder.verify(mockRunListener).testFinished(testDescription);
  }
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:30,代码来源:JUnit4RunnerTest.java

示例10: fireTestStarted

import org.junit.runner.notification.StoppedByUserException; //导入依赖的package包/类
@Override
public void fireTestStarted(Description description) throws StoppedByUserException {
    // empty
}
 
开发者ID:diosmosis,项目名称:junit-composite-runner,代码行数:5,代码来源:NullRunNotifier.java

示例11: userStop

import org.junit.runner.notification.StoppedByUserException; //导入依赖的package包/类
@Test(expected = StoppedByUserException.class)
public void userStop() {
    fNotifier.fireTestStarted(null);
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:5,代码来源:UserStopTest.java

示例12: stopClassRunner

import org.junit.runner.notification.StoppedByUserException; //导入依赖的package包/类
@Test(expected = StoppedByUserException.class)
public void stopClassRunner() throws Exception {
    Request.aClass(OneTest.class).getRunner().run(fNotifier);
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:5,代码来源:UserStopTest.java

示例13: fireTestStarted

import org.junit.runner.notification.StoppedByUserException; //导入依赖的package包/类
@Override
public void fireTestStarted(Description description) throws StoppedByUserException {
    target.fireTestStarted(description);
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:5,代码来源:RuntimeIgnoreRunNotifier.java

示例14: shouldRunStoppedByUserExceptionIfMoreTestsRunAfterAFailure

import org.junit.runner.notification.StoppedByUserException; //导入依赖的package包/类
@Test(expected = StoppedByUserException.class)
public void shouldRunStoppedByUserExceptionIfMoreTestsRunAfterAFailure()
    throws Exception {
  this.testee.testFailure(new Failure(this.junitDesc, this.throwable));
  this.testee.testStarted(this.junitDesc);
}
 
开发者ID:hcoles,项目名称:pitest,代码行数:7,代码来源:AdaptingRunListenerTest.java

示例15: fireTestStarted

import org.junit.runner.notification.StoppedByUserException; //导入依赖的package包/类
@Override
public void fireTestStarted(Description description) throws StoppedByUserException {
  delegate.fireTestStarted(description);
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:5,代码来源:RunNotifierWrapper.java


注:本文中的org.junit.runner.notification.StoppedByUserException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。