Java 类org.junit.experimental.theories.Theory 实例源码

项目:bench    文件:ForkedActorManagerTest.java   
@Theory
public void close_actor_and_watchdog_detects(final AgentClusterRule agentCluster)
        throws ValidationException, IOException, InterruptedException {
    before(agentCluster);
    File rdvFileInit = folder.newFile();
    ActorConfig actorConfig = configWithInitRdv(TestActorWriter.class.getName(), rdvFileInit);
    ManagedActor actor = actorManager.createActor(actorConfig);

    ProcessWatchDogThread watchDogThread = actorManager.getProcesses().get(DUMMY_ACTOR);
    assertNotNull(watchDogThread);

    // Sync with process
    verifyFileContentWithin(rdvFileInit, TestActorWriter.OK, MAX_TIMEOUT_SEC, TimeUnit.SECONDS);

    actor.close();

    // We do not check the fact that the shutdown hook is actually called here
    joinUninterruptibly(watchDogThread);

    assertThat(actorManager.getProcesses().size(), is(0));
    assertThat(watchDogThread.hasProcessExited(), is(true));
}
项目:bench    文件:ForkedActorManagerTest.java   
@Theory
public void close_actor_twice(final AgentClusterRule agentCluster)
        throws ValidationException, IOException, InterruptedException {
    before(agentCluster);
    File rdvFileInit = folder.newFile();
    ActorConfig actorConfig = configWithInitRdv(TestActorWriter.class.getName(), rdvFileInit);
    ManagedActor actor = actorManager.createActor(actorConfig);

    ProcessWatchDogThread watchDogThread = actorManager.getProcesses().get(DUMMY_ACTOR);

    verifyFileContentWithin(rdvFileInit, TestActorWriter.OK, MAX_TIMEOUT_SEC, TimeUnit.SECONDS);

    actor.close();
    actor.close();

    // We do not check the fact that the shutdown hook is actually called here
    joinUninterruptibly(watchDogThread);

    assertThat(actorManager.getProcesses().size(), is(0));
    assertThat(watchDogThread.hasProcessExited(), is(true));
}
项目:bench    文件:WatcherActorsTest.java   
/**
 * Here we monitor the {@link SystemWatcherActor} process using the {@link ProcessWatcherActor}
 *
 * @throws ExecutionException Not expected
 */
@Theory
public void stopWatch_process_monitoring(boolean forked, final Supplier supplier) throws ExecutionException {
    BenchRule benchRule = (BenchRule) supplier.get();
    before(benchRule);
    MetricsRepository metricsRepository = benchRule.metricsRepository();
    Future<MetricValuesMessage> metrics = metricsRepository.expectValuesFor(PROCESS_WATCHER);

    Actors.ActorHandle systemWatcher = createAndInitSystemWatcher(forked);
    Actors.ActorHandle processesWatcher = createProcessWatcher(forked);
    ActorDeployInfo deployInfo = getUninterruptibly(processesWatcher.actorInitialization());

    processesWatcher.send(PROCESS_WATCHER.getName(), startStopwatch(deployInfo.getPid(), METRIC_KEY));

    sleepUninterruptibly(2, TimeUnit.SECONDS);

    processesWatcher.send(PROCESS_WATCHER.getName(), stopStopwatch(deployInfo.getPid(), METRIC_KEY));

    processesWatcher.dumpMetrics();
    sleepUninterruptibly(1, TimeUnit.SECONDS);
    assertThat(getUninterruptibly(metrics).metrics().size(), is(13));
    getUninterruptibly(systemWatcher.close());
    getUninterruptibly(processesWatcher.close());
}
项目:bench    文件:WatcherActorsTest.java   
@Theory
public void sampling_process_monitoring(boolean forked, final Supplier supplier) throws ExecutionException {
    BenchRule benchRule = (BenchRule) supplier.get();
    before(benchRule);
    Future<MetricValuesMessage> metrics = metricsRepository.expectValuesFor(PROCESS_WATCHER);

    Actors.ActorHandle systemWatcher = createAndInitSystemWatcher(forked);
    Actors.ActorHandle processesWatcher = createProcessWatcher(forked);
    ActorDeployInfo deployInfo = getUninterruptibly(processesWatcher.actorInitialization());

    processesWatcher.send(PROCESS_WATCHER.getName(), startSampling(deployInfo.getPid(), 1, METRIC_KEY));

    sleepUninterruptibly(2, TimeUnit.SECONDS);

    processesWatcher.send(PROCESS_WATCHER.getName(), stopSampling(deployInfo.getPid()));

    processesWatcher.dumpMetrics();
    sleepUninterruptibly(1, TimeUnit.SECONDS);
    assertTrue(getUninterruptibly(metrics).metrics().size() > 0);
    getUninterruptibly(systemWatcher.close());
    getUninterruptibly(processesWatcher.close());
}
项目:bench    文件:ResourceManagerAgentTest.java   
@Theory
public void create_and_close_forked_actor_on_agent(final Supplier supplier) throws Exception {
    BenchRule benchRule = (BenchRule) supplier.get();
    before(benchRule);

    List<String> jvmArgs = new ArrayList<>();
    jvmArgs.add("-Xmx128m");
    ActorSync sync = createForkedActor(jvmArgs);

    // Verify that the forked actor is properly registered
    assertThat(actorRegistry.all().size(), is(1));
    assertThat(actorRegistry.byKey(DUMMY_ACTOR).getDeployInfo().getCommand(), hasItem(jvmArgs.get(0)));
    assertTrue(actorRegistry.byKey(DUMMY_ACTOR).getDeployInfo().getPid() > 0);
    assertNotNull(actorRegistry.byKey(DUMMY_ACTOR).getDeployInfo().getEndpoint());

    resourceManager.closeActor(DUMMY_ACTOR);

    sync.assertActorClosed();
    assertThat(actorRegistry.all().size(), is(0));
    after(benchRule);
}
项目:omero-ms-queue    文件:MessageRepeaterTest.java   
@Theory
public void repeatWhenConsumerSaysSo(Duration[] intervals, Integer deliveryCount) {
    assumeThat(deliveryCount, lessThanOrEqualTo(intervals.length));

    Integer sentData = 2;
    MessageRepeater<Integer> target = newRepeater(intervals, Repeat);
    Optional<Schedule<Integer>> schedule = 
            target.consume(newCountedSchedule(deliveryCount), sentData);

    assertTrue(schedule.isPresent());
    assertNear(intervals[deliveryCount - 1], schedule.get().when());
    assertThat(schedule.get().what(), is(sentData));

    assertTrue(consumedData.isPresent());
    assertThat(consumedData.get(), is(sentData));

    assertFalse(exceededRedeliveryData.isPresent());
}
项目:omero-ms-queue    文件:MessageRepeaterTest.java   
@Theory
public void hanlderNeverCalledOnLastDeliveryIfConsumerStops(
        Duration[] intervals, Integer deliveryCount) {
    assumeThat(deliveryCount, greaterThan(intervals.length));

    Integer sentData = 3;
    MessageRepeater<Integer> target = newRepeater(intervals, Stop);
    Optional<Schedule<Integer>> schedule = 
            target.consume(newCountedSchedule(deliveryCount), sentData);

    assertFalse(schedule.isPresent());

    assertTrue(consumedData.isPresent());
    assertThat(consumedData.get(), is(sentData));
    assertFalse(exceededRedeliveryData.isPresent());
}
项目:xpath-to-xml    文件:NotEqualsExprTest.java   
@Theory
public void shouldApplyRightViewToLeftViewWhenShouldCreate(@FromDataPoints("ne left") View<TestNode> left,
                                                           @FromDataPoints("ne left") View<TestNode> right) {
    // given
    if (!(left instanceof NodeView)
            && (!(left instanceof NodeSetView) || !(((NodeSetView) left).iterator().next() instanceof NodeView))) {
        expectedException.expect(XmlBuilderException.class);
    }
    when(leftExpr.resolve(any(ViewContext.class))).thenReturn(left);
    when(rightExpr.resolve(any(ViewContext.class))).thenReturn(right);
    ViewContext<TestNode> context = new ViewContext<>(navigator, parentNode, true);

    // when
    View<TestNode> result = new NotEqualsExpr(leftExpr, rightExpr).resolve(context);

    // then
    assertThat(result).isEqualTo(BooleanView.of(true));
    verify(navigator).setText(any(TestNode.class), eq(Boolean.toString(!right.toBoolean())));
}
项目:omero-ms-queue    文件:ScheduleTest.java   
@Theory
public void equalityAgreesWithHashing(
        FutureTimepoint when1, String what1,
        FutureTimepoint when2, String what2) {
    Schedule<String> s1 = new Schedule<>(when1, what1);
    Schedule<String> s2 = new Schedule<>(when2, what2);

    if (when1.equals(when2) && what1.equals(what2)) {
        assertTrue(s1.equals(s2));
        assertTrue(s2.equals(s1));
        assertThat(s1.hashCode(), is(s2.hashCode()));
    } else {
        assertFalse(s1.equals(s2));
        assertFalse(s2.equals(s1));
        assertThat(s1.hashCode(), is(not(s2.hashCode())));
    }
}
项目:omero-ms-queue    文件:ClassPathTest.java   
@Theory
public void fromStringYieldsSameClassPathAsThatBuiltByAppendingPaths(
        Path p1, Path p2, Path p3) {
    String cp = p1 + Separator + p2 + Separator + p3;
    ClassPath parsed = ClassPathFactory.fromString(cp);
    ClassPath built = new ClassPath().add(p1, p2, p3);

    assertNotNull(parsed);
    assertThat(parsed, is(built));

    String parsedToString = parsed.toString();
    String builtToString = built.toString();
    assertNotNull(parsedToString);
    assertNotNull(builtToString);        
    assertThat(parsedToString, is(builtToString));

    Stream<Path> parsedToStream = parsed.toStream();
    Stream<Path> builtToStream = built.toStream();
    assertNotNull(parsedToStream);
    assertNotNull(builtToStream);
    assertArrayEquals(parsedToStream.toArray(), builtToStream.toArray());
}
项目:omero-ms-queue    文件:ClassPathTest.java   
@Theory
public void addOrderIsRespected(Path p1, Path p2, Path p3) {
    String[] actual = new ClassPath()
                     .add(p1, p2, p3)
                     .toStream()
                     .map(Path::toString)
                     .toArray(String[]::new);

    LinkedHashSet<String> ps = new LinkedHashSet<>();  // respects add order
    ps.add(p1.toString());
    ps.add(p2.toString());
    ps.add(p3.toString());
    ps.remove("");
    String[] expected = ps.toArray(new String[0]);

    assertArrayEquals(expected, actual);
}
项目:bench    文件:ForkedActorManagerTest.java   
@Theory
public void null_parameters_invalid(final AgentClusterRule agentCluster) {
    before(agentCluster);
    NullPointerTester tester = new NullPointerTester();

    tester.testAllPublicConstructors(ForkedActorManager.class);
    tester.testAllPublicInstanceMethods(actorManager);
}
项目:bench    文件:ForkedActorManagerTest.java   
@Theory
public void create_actor_init_called(final AgentClusterRule agentCluster)
        throws ValidationException, IOException, InterruptedException {
    before(agentCluster);
    File rdvFile = folder.newFile();
    ActorConfig actorConfig = configWithInitRdv(TestActorWriter.class.getName(), rdvFile);

    ManagedActor actor = actorManager.createActor(actorConfig);

    assertNotNull(actor);
    assertThat(actor.getKey(), is(DUMMY_ACTOR));
    verifyFileContentWithin(rdvFile, TestActorWriter.OK, MAX_TIMEOUT_SEC, TimeUnit.SECONDS);
}
项目:personium-core    文件:RangeHeaderHandlerTest.java   
/**
 * 正常系.
 * @param f テストデータ
 * @throws Exception Exception
 */
@Theory
public void 正常系206(Fixture f) throws Exception {
    // 単一バイトレンジ指定のテストなので0固定
    int byteRangeSpecIndex = 0;

    // Rangeヘッダパース
    RangeHeaderHandler range = RangeHeaderHandler.parse(f.rangeHeaderField, f.contentSize);

    // byte-range-setの数チェック
    assertEquals(1, range.getByteRangeSpecCount());

    List<ByteRangeSpec> brss = range.getByteRangeSpecList();
    ByteRangeSpec brs = brss.get(byteRangeSpecIndex);

    // 開始・終了値チェック
    assertEquals(f.expectedFirstBytePos, brs.getFirstBytePos());
    assertEquals(f.expectedLastBytePos, brs.getLastBytePos());

    // Rangeヘッダが有効であることのチェック
    assertEquals(true, range.isValid());

    // 範囲外の指定でないことをチェック
    assertEquals(true, range.isSatisfiable());

    // Content-Lengthのチェック
    assertEquals(f.expectedContentSize, brs.getContentLength());

    // Content-Rangeヘッダのチェック
    assertEquals(f.expectedContentRange, brs.makeContentRangeHeaderField());
}
项目:omero-ms-queue    文件:CryptoSourceReaderTest.java   
@Theory
public void writeThenReadIsIdentity(byte[] input) throws Exception {
    ByteArrayInputStream source = encrypt(input);
    byte[] decrypted = decryptionFilter.read(source);

    assertArrayEquals(input, decrypted);
}
项目:bench    文件:ForkedActorManagerTest.java   
@Theory
public void create_manager_but_cant_create_local_log_dir(final AgentClusterRule agentCluster) throws IOException {
    before(agentCluster);
    File folder = this.folder.newFolder();
    File localLogDir = spy(folder);
    doReturn(false).when(localLogDir).mkdirs(); // NOSONAR
    doReturn(false).when(localLogDir).exists(); // NOSONAR

    expectedException.expect(IllegalStateException.class);
    actorManager = new ForkedActorManager(clusterConfigFactory, localLogDir);
}
项目:bench    文件:ForkedActorManagerTest.java   
@Theory
public void watchdog_thread_is_interrupted_while_waitfor(final AgentClusterRule agentCluster)
        throws InterruptedException {
    before(agentCluster);
    Process mockedProcess = mock(Process.class);
    when(mockedProcess.waitFor()).thenThrow(new InterruptedException());
    ProcessWatchDogThread watchdog = new ProcessWatchDogThread(DUMMY_ACTOR.getName(), mockedProcess, actorManager);
    watchdog.start();
    watchdog.awaitUntilStarted();
    watchdog.close();

    joinUninterruptibly(watchdog);

    assertThat(watchdog.hasProcessExited(), is(false));
}
项目:bench    文件:AgentBootstrapIntegrationTest.java   
@Theory
public void bootstrap_with_server(final AgentClusterRule clusterRule) throws Exception {
    before(clusterRule);
    AgentRegistryListener listener = mock(AgentRegistryListener.class);
    registryClusterClient.startRegistryListener(listener);

    agentBootstrapThread.start();

    verify(listener, timeout(TIMEOUT_MS)).onAgentRegistration(any(AgentRegistrationMessage.class));
    verifyNoMoreInteractions(listener);
    after(clusterRule);
}
项目:bench    文件:WatcherActorsTest.java   
@Theory
public void create_and_initialize_watcher_actors(boolean forked, final Supplier supplier)
        throws ExecutionException {
    BenchRule benchRule = (BenchRule) supplier.get();
    before(benchRule);
    Actors.ActorHandle systemWatcher = createSystemWatcher(forked);
    Actors.ActorHandle processesWatcher = createProcessWatcher(forked);

    getUninterruptibly(systemWatcher.actorInitialization());
    getUninterruptibly(processesWatcher.actorInitialization());
}
项目:xpath-to-xml    文件:AdditionExprTest.java   
@Theory
public void shouldAddLeftViewToRightView(@FromDataPoints("3.0") View<TestNode> left,
                                         @FromDataPoints("3.0") View<TestNode> right) {
    // given
    when(leftExpr.resolve(any(ViewContext.class))).thenReturn(left);
    when(rightExpr.resolve(any(ViewContext.class))).thenReturn(right);
    ViewContext<TestNode> context = new ViewContext<>(navigator, new NodeView<>(node("node")), false);

    // when
    assertThat(new AdditionExpr(leftExpr, rightExpr).resolve(context)).extracting("number").contains(6.0);
}
项目:omero-ms-queue    文件:IdentifiableHashTest.java   
@Theory
public void negativeNumberOfBucketsIsSameAsPositive(Integer nBuckets) {
    assertSameFunction(
            buckets(nBuckets, range(-100, 100)),
            buckets(-nBuckets, range(-100, 100))
    );
}
项目:bench    文件:ResourceManagerAgentTest.java   
@Theory
public void create_and_close_embedded_actor_on_agent(final Supplier supplier) throws Exception {
    BenchRule benchRule = (BenchRule) supplier.get();
    before(benchRule);

    List<String> preferredHosts = new ArrayList<>();
    ActorSync sync = createActorWith(preferredHosts);
    sync.assertActorCreated();

    resourceManager.closeActor(DUMMY_ACTOR);

    sync.assertActorClosed();
    assertThat(actorRegistry.all().size(), is(0));
    after(benchRule);
}
项目:xpath-to-xml    文件:SubtractionExprTest.java   
@Theory
public void shouldMultiplyLeftViewToRightView(@FromDataPoints("3.0") View<TestNode> left,
                                              @FromDataPoints("3.0") View<TestNode> right) {
    // given
    when(leftExpr.resolve(any(ViewContext.class))).thenReturn(left);
    when(rightExpr.resolve(any(ViewContext.class))).thenReturn(right);
    ViewContext<TestNode> context = new ViewContext<>(navigator, new NodeView<>(node("node")), false);

    // when
    assertThat(new SubtractionExpr(leftExpr, rightExpr).resolve(context)).extracting("number").contains(0.0);
}
项目:Java-EX    文件:StringUtilTest.java   
@Theory
public void testNotExistChars(@TestedOn(ints = { 5, 50, 500 }) int count) {
  StringBuilder sb = new StringBuilder();
  IntStream.range(0, count)
      .mapToObj(a -> (char) (Math.random() * 100 + 128))
      .forEach(sb::append);
  String string = sb.toString();
  Flowable.fromIterable(() -> notExistChars(string))
      .test(0)
      .requestMore(count)
      .assertNever(c -> string.indexOf(c.charValue()) != -1);
}
项目:omero-ms-queue    文件:StreamOpsReadLinesIntoStringTest.java   
@Theory
public void joiningLinesThenReadingIsTheIdentity(String[] lines) {
    String expected = buildTextInput(lines);
    InputStream input = toInputStream(expected);
    String actual = readLinesIntoString(input);

    assertThat(actual, is(expected));
}
项目:xpath-to-xml    文件:GreaterThanOrEqualsExprTest.java   
@Theory
public void shouldResolveToTrueWhenLeftIsGreaterThanRight(@FromDataPoints("less") View<TestNode> less,
                                                          @FromDataPoints("greater") View<TestNode> greater) {
    // given
    when(leftExpr.resolve(any(ViewContext.class))).thenReturn(greater);
    when(rightExpr.resolve(any(ViewContext.class))).thenReturn(less);
    ViewContext<TestNode> context = new ViewContext<>(navigator, parentNode, false);

    // when
    View<TestNode> result = new GreaterThanOrEqualsExpr(leftExpr, rightExpr).resolve(context);

    // then
    assertThat(result).isEqualTo(BooleanView.of(true));
}
项目:omero-ms-queue    文件:WrapperTest.java   
@Theory
public void equalsDelegatesToWrappedValue(Wrapper<String> w, String x) {
    assumeTrue(w != null);  // (*)

    String wrappedValue = w.get();
    assertThat(w.equals(x), is(wrappedValue.equals(x)));
}
项目:omero-ms-queue    文件:SerializationFactoryTest.java   
@Theory
public void serializeThenDeserializeIsIdentity(CryptoConfigSource config,
                                               String value)
        throws Exception{
    SerializationFactory sf = new SerializationFactory(config);

    ByteArrayOutputStream sink = new ByteArrayOutputStream();
    sf.serializer().write(sink, value);

    ByteArrayInputStream source =
            new ByteArrayInputStream(sink.toByteArray());
    String deserialized = sf.deserializer(String.class).read(source);

    assertThat(deserialized, is(value));
}
项目:omero-ms-queue    文件:RemoteMountTest.java   
@Theory
public void nullNeverTranslatesToLocalPath(
        RemoteBase remote, LocalBase local) {
    RemoteMount target = new RemoteMount(uri(remote), path(local));

    Optional<Path> actual = target.toLocalPath(null);
    assertFalse(actual.isPresent());
}
项目:omero-ms-queue    文件:RemoteMountTest.java   
@Theory
public void localPathNeverTranslatesToLocalPath(
        RemoteBase remote, LocalBase local, String path) {
    RemoteMount target = new RemoteMount(uri(remote), path(local));

    Optional<Path> actual = target.toLocalPath(uri(path));
    assertFalse(actual.isPresent());
}
项目:omero-ms-queue    文件:RemoteMountTest.java   
@Theory
public void translateRemotePathIfSameRemotePrefix(
        RemoteBase remote, LocalBase local, String path) {
    RemoteMount target = new RemoteMount(uri(remote), path(local));
    URI input = join(remote, path);
    Path expected = join(local, path);

    Optional<Path> actual = target.toLocalPath(input);
    assertTrue(actual.isPresent());
    assertThat(actual.get(), is(expected));
}
项目:omero-ms-queue    文件:RemoteMountTest.java   
@Theory
public void neverTranslateRemotePathIfNotSameRemotePrefix(
        RemoteBase remote, LocalBase local, String path) {
    assumeThat(remote.get(), not(endsWith("/")));

    RemoteMount target = new RemoteMount(uri(remote), path(local));
    RemoteBase otherRemote = new RemoteBase(remote.get() + "different");
    URI input = join(otherRemote, path);

    Optional<Path> actual = target.toLocalPath(input);
    assertFalse(actual.isPresent());
}
项目:omero-ms-queue    文件:RemoteFilePathTest.java   
@Theory
public void isRemoteJustInCaseIsFileSchemeAndHasHost(
        Scheme s, Host h, String path) {
    String scheme = s.get(), host = h.get();
    URI x = buildURI(scheme, host, path);

    boolean expected = "file".equals(scheme) && !host.isEmpty();
    boolean actual = RemoteMount.isRemoteFilePath(x);

    assertThat(actual, is(expected));
}
项目:omero-ms-queue    文件:ImportBatchStatusTest.java   
@Theory
public void allProcessedTrueIfAllImportsBeenAdded(int nSuccess, int nFails) {
    assumeTrue(isPartition(nSuccess, nFails));

    markCompletions(target, nSuccess, nFails);

    assertTrue(target.allProcessed());
    assertSuccessAndFailSetsAreDisjoint(nSuccess, nFails);
}
项目:omero-ms-queue    文件:WrapperTest.java   
@Theory
public void toStringDelegatesToWrappedValue(Wrapper<String> w) {
    assumeTrue(w != null);  // (*)

    String wrappedValue = w.get();
    assertThat(w.toString(), is(wrappedValue));
}
项目:omero-ms-queue    文件:EithersPartitionTest.java   
@Theory
public void leaveLeftNullsBe(String[] ls) {
    Stream<Either<String, Integer>> xs = asStream(ls).map(Either::left);
    List<String> actual = partitionEithers(xs).fst();

    assertThat(actual, contains(ls));
}
项目:xpath-to-xml    文件:LessThanOrEqualsExprTest.java   
@Theory
public void shouldResolveToTrueWhenLeftIsLessThanRight(@FromDataPoints("less") View<TestNode> less,
                                                       @FromDataPoints("greater") View<TestNode> greater) {
    // given
    when(leftExpr.resolve(any(ViewContext.class))).thenReturn(less);
    when(rightExpr.resolve(any(ViewContext.class))).thenReturn(greater);
    ViewContext<TestNode> context = new ViewContext<>(navigator, parentNode, false);

    // when
    View<TestNode> result = new LessThanOrEqualsExpr(leftExpr, rightExpr).resolve(context);

    // then
    assertThat(result).isEqualTo(BooleanView.of(true));
}
项目:omero-ms-queue    文件:RemotePathMapperTest.java   
@Theory
public void forceLocalPathSameAsToLocalPathWhenInputIsMatchingRemotePath(
        RemoteMount[] remoteToLocalMap, URI matchingRemotePath) {
    assumeThat(remoteToLocalMap.length, greaterThan(0));

    RemotePathResolver target = resolver(remoteToLocalMap);
    Path p1 = target.forceLocalPath(matchingRemotePath);
    Optional<Path> p2 = target.toLocalPath(matchingRemotePath);

    assertNotNull(p1);
    assertNotNull(p2);
    assertTrue(p2.isPresent());
    assertThat(p1, is(p2.get()));
}
项目:omero-ms-queue    文件:EithersPartitionTest.java   
@Theory
public void leaveRightNullsBe(Integer[] rs) {
    Stream<Either<String, Integer>> xs = asStream(rs).map(Either::right);
    List<Integer> actual = partitionEithers(xs).snd();

    assertThat(actual, contains(rs));
}
项目:omero-ms-queue    文件:ImportOutcomeNotifierTest.java   
@Theory
public void userIsAlwaysNotified(
        ImportBatchStatus outcome, String sysAdminEmail) {
    ImportEnv env = mockedImportEnvWithMemBatchStore(sysAdminEmail);
    ImportOutcomeNotifier target = new ImportOutcomeNotifier(env, outcome);
    target.notifyOutcome();

    Email user = ImportOutcomeNotifier.findAnyEmail(outcome);
    verify(env.mail(), times(1)).enqueue(
            argThat(hasRecipientOf(user.get())));
}