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


Java Sequence类代码示例

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


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

示例1: testUpdateBookingsCorrectlyCallsTheManagers

import org.jmock.Sequence; //导入依赖的package包/类
@Test
public void testUpdateBookingsCorrectlyCallsTheManagers() throws Exception {

  // Test happy path for updateBookings: we verify the IPageManager
  // is asked to refresh all booking pages, and then the IBookingManager
  // is asked to delete the previous day's bookings.

  // ARRANGE
  final Sequence refreshSequence = mockery.sequence("refresh");
  mockery.checking(new Expectations() {
    {
      oneOf(updateBookingsLambda.getPageManager(mockLogger)).refreshAllPages(with(validDates),
          with(apiGatewayBaseUrl), with(revvingSuffix));
      inSequence(refreshSequence);

      oneOf(updateBookingsLambda.getBookingManager(mockLogger)).deleteYesterdaysBookings(false);
      inSequence(refreshSequence);
    }
  });

  // ACT
  UpdateBookingsLambdaRequest request = new UpdateBookingsLambdaRequest();

  updateBookingsLambda.updateBookings(request, mockContext);
}
 
开发者ID:robinsteel,项目名称:Sqawsh,代码行数:26,代码来源:UpdateBookingsLambdaTest.java

示例2: happyCase

import org.jmock.Sequence; //导入依赖的package包/类
@Test
public void happyCase() throws Exception {

    final String someName = "Foobar";

    // given
    final Sequence seq = context.sequence("create");
    context.checking(new Expectations() {
        {
            oneOf(mockServiceRegistry).injectServicesInto(with(any(SimpleObject.class)));
            inSequence(seq);

            oneOf(mockRepositoryService).persist(with(nameOf(someName)));
            inSequence(seq);
        }

    });

    // when
    final SimpleObject obj = simpleObjectRepository.create(someName);

    // then
    assertThat(obj).isNotNull();
    assertThat(obj.getName()).isEqualTo(someName);
}
 
开发者ID:Stephen-Cameron-Data-Services,项目名称:isis-agri,代码行数:26,代码来源:SimpleObjectRepositoryTest.java

示例3: testGetSafeParameterString

import org.jmock.Sequence; //导入依赖的package包/类
@Test
public void testGetSafeParameterString() {
    final HttpServletRequest request = context.mock(HttpServletRequest.class);

    context.checking(new Expectations() {

        {
            Sequence getParams = new NamedSequence("getParams");

            for (Map.Entry<String, String> entry : stringParams.entrySet()) {
                oneOf(request).getParameter(entry.getKey());
                inSequence(getParams);
                will(returnValue(entry.getValue()));
            }
        }
    });

    String value = ServletUtils.getSafeParameter(request, "param1", "default");
    assertThat("value1", equalTo(value));
    value = ServletUtils.getSafeParameter(request, "param2", "default");
    assertThat("value2", equalTo(value));
    value = ServletUtils.getSafeParameter(request, "param3", "default");
    assertThat("default", equalTo(value));
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:25,代码来源:ServletUtilsTest.java

示例4: testGetSafeParameterInt

import org.jmock.Sequence; //导入依赖的package包/类
@Test
public void testGetSafeParameterInt() {
    final HttpServletRequest request = context.mock(HttpServletRequest.class);

    context.checking(new Expectations() {

        {
            Sequence getParams = new NamedSequence("getParams");

            for (Map.Entry<String, String> entry : intParams.entrySet()) {
                oneOf(request).getParameter(entry.getKey());
                inSequence(getParams);
                will(returnValue(entry.getValue()));
            }
        }
    });

    int value = ServletUtils.getSafeParameter(request, "param1", 0);
    assertEquals(1, value);
    value = ServletUtils.getSafeParameter(request, "param2", 0);
    assertEquals(2, value);
    value = ServletUtils.getSafeParameter(request, "param3", 0);
    assertEquals(0, value);
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:25,代码来源:ServletUtilsTest.java

示例5: happyCase

import org.jmock.Sequence; //导入依赖的package包/类
@Test
public void happyCase() throws Exception {

    // given
    final QuickObject quickObject = new QuickObject();

    final Sequence seq = context.sequence("create");
    context.checking(new Expectations() {
        {
            oneOf(mockContainer).newTransientInstance(QuickObject.class);
            inSequence(seq);
            will(returnValue(quickObject));

            oneOf(mockContainer).persistIfNotAlready(quickObject);
            inSequence(seq);
        }
    });

    // when
    final QuickObject obj = quickObjectRepository.create("Foobar");

    // then
    assertThat(obj).isEqualTo(quickObject);
    assertThat(obj.getName()).isEqualTo("Foobar");
}
 
开发者ID:isisaddons-legacy,项目名称:isis-app-quickstart,代码行数:26,代码来源:QuickObjectRepositoryTest.java

示例6: testSetStatus

import org.jmock.Sequence; //导入依赖的package包/类
@Test
public void testSetStatus() {
  final Sequence setSequence = context.sequence("setSequence");
  final Sequence getSequence = context.sequence("getSequence");
  
  context.checking(new Expectations() {{
    oneOf (textComponent).setText("First Status\n"); inSequence(setSequence);
    oneOf (textComponent).setText("First Status\nSecond Status\n"); 
        inSequence(setSequence);
    oneOf (textComponent).getText(); inSequence(getSequence); 
        will(returnValue(""));
    oneOf (textComponent).getText(); inSequence(getSequence); 
        will(returnValue("First Status\n"));
    oneOf (textComponent).getText(); inSequence(getSequence); 
        will(returnValue("First Status\n"));
    oneOf (textComponent).getText(); inSequence(getSequence); 
        will(returnValue("First Status\nSecondStatus\n"));
  }});
  
  progressListener.setStatus("First Status");
  assertEquals("First Status", progressListener.getStatus());
  progressListener.setStatus("Second Status");
  assertEquals("Second Status", progressListener.getStatus());
}
 
开发者ID:sih4sing5hong5,项目名称:google-sites-liberation,代码行数:25,代码来源:GuiProgressListenerTest.java

示例7: happyCase

import org.jmock.Sequence; //导入依赖的package包/类
@Test
public void happyCase() throws Exception {

    // given
    final SimpleObject simpleObject = new SimpleObject();

    final Sequence seq = context.sequence("create");
    context.checking(new Expectations() {
        {
            oneOf(mockContainer).newTransientInstance(SimpleObject.class);
            inSequence(seq);
            will(returnValue(simpleObject));

            oneOf(mockContainer).persistIfNotAlready(simpleObject);
            inSequence(seq);
        }
    });

    // when
    final SimpleObject obj = simpleObjects.create("Foobar");

    // then
    assertThat(obj).isEqualTo(simpleObject);
    assertThat(obj.getName()).isEqualTo("Foobar");
}
 
开发者ID:isisaddons,项目名称:isis-app-simpledsl,代码行数:26,代码来源:SimpleObjectsTest.java

示例8: testThatDisposeUnsetsTheActiveStatusAndStopsTheDiscoveryService

import org.jmock.Sequence; //导入依赖的package包/类
@Test
public void testThatDisposeUnsetsTheActiveStatusAndStopsTheDiscoveryService() {
	final DiscoveryService discoveryService = context.mock(DiscoveryService.class);
	final Sequence seq = context.sequence("StartStopSequence");
	
	context.checking(new Expectations() {{
		atMost(1).of(discoveryServiceFactory).createDiscoveryService(peerProvider, discoveryServiceConfig);
		inSequence(seq);

		atMost(1).of(discoveryService).startDiscoveryService();
		inSequence(seq);
		
		atMost(1).of(discoveryService).stopDiscoveryService();
		inSequence(seq);
	}});

	peerProvider.init();
	Assert.assertTrue(peerProvider.isActive());
	peerProvider.dispose();
	Assert.assertFalse(peerProvider.isActive());
}
 
开发者ID:brdara,项目名称:ehcache-aws,代码行数:22,代码来源:AwsSecurityGroupAwareCacheManagerPeerProviderTest.java

示例9: happyCase

import org.jmock.Sequence; //导入依赖的package包/类
@Test
public void happyCase() throws Exception {

    // given
    final Owner owner = new Owner();

    final Sequence seq = context.sequence("create");
    context.checking(new Expectations() {
        {
            oneOf(mockContainer).newTransientInstance(Owner.class);
            inSequence(seq);
            will(returnValue(owner));

            oneOf(mockContainer).persistIfNotAlready(owner);
            inSequence(seq);
        }
    });

    // when
    final Owner obj = owners.create("George");

    // then
    assertThat(obj, is(owner));
    assertThat(obj.getName(), is("George"));
}
 
开发者ID:danhaywood,项目名称:isis-app-petclinic,代码行数:26,代码来源:OwnersTest.java

示例10: testEmptyStateGeneratesNewLock

import org.jmock.Sequence; //导入依赖的package包/类
@Test
    public void testEmptyStateGeneratesNewLock() throws Exception {
        final Sequence callSeq = jmock.sequence("call-seq");


        jmock.checking(new Expectations() {{
//            oneOf(readLock).lock();inSequence(callSeq);
            oneOf(mapStoredState).get();will(returnValue(null));inSequence(callSeq);
            oneOf(boundLockFactory).newInstance();will(returnValue(factoryGeneratedState));inSequence(callSeq);
            oneOf(mapStoredState).compareAndSet(null, factoryGeneratedState);will(returnValue(true));inSequence(callSeq);
//            oneOf(readLock).unlock();inSequence(callSeq);
            oneOf(factoryGeneratedState).sharedLock(with(aNull(LockClient.class)),with(any(String.class)));inSequence(callSeq);
        }});

        constructedLock.readLock().lock();
    }
 
开发者ID:Tesora,项目名称:tesora-dve-pub,代码行数:17,代码来源:ClusterLockManagerTest.java

示例11: testReadLock

import org.jmock.Sequence; //导入依赖的package包/类
@Test
    public void testReadLock() throws Exception {
        final Sequence callSeq = jmock.sequence("call-seq");

        jmock.checking(new Expectations() {{
//            oneOf(readLock).lock();inSequence(callSeq);
            oneOf(mapStoredState).get();will(returnValue(factoryGeneratedState));inSequence(callSeq);
//            oneOf(readLock).unlock();inSequence(callSeq);
            oneOf(factoryGeneratedState).sharedLock(with(aNull(LockClient.class)),with(any(String.class)));inSequence(callSeq);
        }});

        constructedLock.readLock().lock();

        jmock.checking(new Expectations() {{
//            oneOf(readLock).lock();inSequence(callSeq);
            oneOf(mapStoredState).get();will(returnValue(factoryGeneratedState));inSequence(callSeq);
//            oneOf(readLock).unlock();inSequence(callSeq);
            oneOf(factoryGeneratedState).sharedUnlock(with(aNull(LockClient.class)),with(any(String.class)));inSequence(callSeq);
        }});
        constructedLock.readLock().unlock();
    }
 
开发者ID:Tesora,项目名称:tesora-dve-pub,代码行数:22,代码来源:ClusterLockManagerTest.java

示例12: testWriteLock

import org.jmock.Sequence; //导入依赖的package包/类
@Test
    public void testWriteLock() throws Exception {
        final Sequence callSeq = jmock.sequence("call-seq");

        jmock.checking(new Expectations() {{
//            oneOf(readLock).lock();inSequence(callSeq);
            oneOf(mapStoredState).get();will(returnValue(factoryGeneratedState));inSequence(callSeq);
//            oneOf(readLock).unlock();inSequence(callSeq);
            oneOf(factoryGeneratedState).exclusiveLock(with(aNull(LockClient.class)),with(any(String.class)));inSequence(callSeq);
        }});

        constructedLock.writeLock().lock();

        jmock.checking(new Expectations() {{
//            oneOf(readLock).lock();inSequence(callSeq);
            oneOf(mapStoredState).get();will(returnValue(factoryGeneratedState));inSequence(callSeq);
//            oneOf(readLock).unlock();inSequence(callSeq);
            oneOf(factoryGeneratedState).exclusiveUnlock(with(aNull(LockClient.class)),with(any(String.class)));
            inSequence(callSeq);
        }});
        constructedLock.writeLock().unlock();
    }
 
开发者ID:Tesora,项目名称:tesora-dve-pub,代码行数:23,代码来源:ClusterLockManagerTest.java

示例13: testOnMessage

import org.jmock.Sequence; //导入依赖的package包/类
@Test
    public void testOnMessage() throws Exception {
        final Sequence callSeq = jmock.sequence("call-seq");

        final IntentEntry entry = new IntentEntry(InetSocketAddress.createUnresolved("localhost",1111),LockMode.EXCLUSIVE,15L,15L);
        final ClusterLockManager.MultiplexedLockMessage multiplexedMessage = new ClusterLockManager.MultiplexedLockMessage(lockName,entry);

        jmock.checking(new Expectations() {{
            oneOf(currentLocks).binding(lockName);will(returnValue(mapStoredState));inSequence(callSeq);
            oneOf(lockFactoryBinder).createFactory(lockName);will(returnValue(boundLockFactory));inSequence(callSeq);
            oneOf(clusterMembershipLock).readLock();will(returnValue(readLock));inSequence(callSeq);

//            oneOf(readLock).lock();inSequence(callSeq);
            oneOf(mapStoredState).get();will(returnValue(factoryGeneratedState));inSequence(callSeq);
//            oneOf(readLock).unlock();inSequence(callSeq);
            oneOf(factoryGeneratedState).onMessage(entry);inSequence(callSeq);
        }});


        mgr.onMessage(multiplexedMessage);
    }
 
开发者ID:Tesora,项目名称:tesora-dve-pub,代码行数:22,代码来源:ClusterLockManagerTest.java

示例14: andConditions

import org.jmock.Sequence; //导入依赖的package包/类
@Test
public void andConditions() throws Exception{
	Method m = createMethodForTesting(Object.class, "getPersonByNameAndAge", String.class, int.class);
	QueryInfo qi = parser.parse(m);
    final QueryVisitor visitorMock = context.mock(QueryVisitor.class);
    
    context.checking(new Expectations() {{
    	Sequence sequence = context.sequence("query sequence");
   	 	one(visitorMock).visitEntity("Person");inSequence(sequence);
   	 	one(visitorMock).visitCondition("name", ComparisonType.EQUALS);inSequence(sequence);
   	 	one(visitorMock).visitConector("and");inSequence(sequence);
   	 	one(visitorMock).visitCondition("age", ComparisonType.EQUALS);inSequence(sequence);
   	 	one(visitorMock).visitEnd(); inSequence(sequence);
   	}});
    
    qi.visit(visitorMock);	
}
 
开发者ID:EsfingeFramework,项目名称:querybuilder,代码行数:18,代码来源:DSLMethodParserTest.java

示例15: orConditions

import org.jmock.Sequence; //导入依赖的package包/类
@Test
public void orConditions() throws Exception{
	Method m = createMethodForTesting(Object.class, "getPersonByNameOrAge", String.class, int.class);
	QueryInfo qi = parser.parse(m);
    final QueryVisitor visitorMock = context.mock(QueryVisitor.class);
    
    context.checking(new Expectations() {{
    	Sequence sequence = context.sequence("query sequence");
   	 	one(visitorMock).visitEntity("Person");inSequence(sequence);
   	 	one(visitorMock).visitCondition("name", ComparisonType.EQUALS);inSequence(sequence);
   	 	one(visitorMock).visitConector("or");inSequence(sequence);
   	 	one(visitorMock).visitCondition("age", ComparisonType.EQUALS);inSequence(sequence);
   	 	one(visitorMock).visitEnd(); inSequence(sequence);
    }});
    
    qi.visit(visitorMock);	
}
 
开发者ID:EsfingeFramework,项目名称:querybuilder,代码行数:18,代码来源:DSLMethodParserTest.java


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