Package org.jmock.integration.junit4

Examples of org.jmock.integration.junit4.JUnit4Mockery


    /** instance under test */
    IPublisher instance;
   
    @Before
    public void setUp() {
        context = new JUnit4Mockery();
        instance = new PublisherImpl();
    }
View Full Code Here


        fail();
    }

    @Test (expected = RuntimeException.class)
    public void expectedExceptionFailsInMainTestThreadWithoutJUnitFrameworkIntervention() throws Throwable {
        Mockery context = new JUnit4Mockery() {{
            setImposteriser(ClassImposteriser.INSTANCE);
            setThreadingPolicy(new Synchroniser());
        }};
        FrameworkMethod method = createMethodWithExpectations(context);
        Statement statement = createStatementWithExpectations(context);
        new RunConcurrently(method, statement).evaluate();
        context.assertIsSatisfied();
    }
View Full Code Here

    private UserProfile profile;

    @Before
    public void setup() throws Exception {
        Logger.getRootLogger().setLevel(Level.OFF);
        final Mockery mockery = new JUnit4Mockery();
        final ArrayList<Object> servicesList = new ArrayList<Object>();
        service = new TestServiceObject1();
        servicesList.add(service);
        final IsisSessionFactory executionContextFactory =
            new IsisSessionFactoryDefault(DeploymentType.EXPLORATION, new IsisConfigurationDefault(),
                mockery.mock(TemplateImageLoader.class), mockery.mock(SpecificationLoader.class),
                mockery.mock(AuthenticationManager.class), mockery.mock(AuthorizationManager.class),
                mockery.mock(UserProfileLoader.class), mockery.mock(PersistenceSessionFactory.class), servicesList);

        IsisContextStatic.createRelaxedInstance(executionContextFactory);

        final XMLReader parser = XMLReaderFactory.createXMLReader();
        final UserProfileDataHandler handler = new UserProfileDataHandler();
View Full Code Here

    public DelegatingMockery(final Mockery underlying) {
        this.underlying = underlying;
    }

    public DelegatingMockery() {
        this(new JUnit4Mockery());
    }
View Full Code Here

    @Before
    public void setup() {
        IsisContext.setConfiguration(new TestProxyConfiguration());

        mockery = new JUnit4Mockery();

        layout = new GridLayout();
        container = mockery.mock(View.class, "container");
    }
View Full Code Here

      if ( Mockery.class.isAssignableFrom(field.getType())) {
        if ( field.getAnnotation(Mock.class) != null )
          throw new IncompatibleAnnotationException(Mock.class, field.getType());
       
        if ( Mockery.class.equals(field.getType())) {
          mockery = new JUnit4Mockery();
        } else {
          mockery = (Mockery)field.getType().newInstance();
        }
        jmockFields.put(field, mockery);
        break;
      }
    }
   
    for ( Field field : fields ) {
      boolean isMock = (field.getAnnotation(Mock.class) != null);
      boolean isStub = (field.getAnnotation(Stub.class) != null);
      if ( !isMock && !isStub ) continue;
      if ( isMock && (mockery == null) ) throw new NoMockeryException();
      if ( isStub && (mockery == null) ) mockery = new JUnit4Mockery();
     
      Class<?> fieldType = field.getType();
      if ( fieldType.isArray() ) {
        Object[] array = (Object[])Array.newInstance(fieldType.getComponentType(), 3);
        for ( int i = 0; i < array.length; i++ ) {
View Full Code Here

        }      
    }
   
    @Before
    public void setUp() throws Exception {
        context = new JUnit4Mockery() {{
            setImposteriser(ClassImposteriser.INSTANCE);
        }};
        brokerA = new BrokerService();
        brokerA.setBrokerName("BrokerA");
        configure(brokerA);
View Full Code Here

  /**
   * @throws java.lang.Exception
   */
  @Before
  public void setUp() throws Exception {
    context = new JUnit4Mockery(){{
          setImposteriser(ClassImposteriser.INSTANCE);
      }};
      mockMatrix = context.mock(ArticleMatrix.class);
    gameRunningManager=new GameRunningManager(mockMatrix);
  }
View Full Code Here

        Assert.assertFalse(api.has(Tokens.PARAMETERS));
    }

    @Test
    public void getExtensionApiAsJsonDescriptorOnlyHasApiElements() {
        this.mockery = new JUnit4Mockery();

        final ExtensionDescriptor extensionDescriptor = this.mockery.mock(ExtensionDescriptor.class);
        final ExtensionApi extensionApi = this.mockery.mock(ExtensionApi.class);

        this.mockery.checking(new Expectations() {{
View Full Code Here

    }

    @Test
    public void getExtensionApiAsJsonParameterOnlyHasApiElements() {
        this.mockery = new JUnit4Mockery();

        final ExtensionDescriptor extensionDescriptor = this.mockery.mock(ExtensionDescriptor.class);
        final ExtensionApi extensionApi = this.mockery.mock(ExtensionApi.class);

        this.mockery.checking(new Expectations() {{
View Full Code Here

TOP

Related Classes of org.jmock.integration.junit4.JUnit4Mockery

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.