Examples of TestInstance


Examples of com.mycila.testing.core.TestInstance

                return "a string";
            }
        };
        mockery.checking(new Expectations() {{
            allowing(ctx).getTest();
            will(returnValue(new TestInstance(test)));
        }});
        assertNull(test.get());
        plugin.prepareTestInstance(ctx);
    }
View Full Code Here

Examples of com.mycila.testing.core.TestInstance

                return JMock2TestPluginTest.this.mockery3;
            }
        };
        mockery.checking(new Expectations() {{
            allowing(ctx).getTest();
            will(returnValue(new TestInstance(test)));
            one(ctx).setAttribute(with("org.jmock.Mockery"), with(any(Mockery.class)));
        }});
        assertNull(test.get());
        plugin.prepareTestInstance(ctx);
        assertNotNull(test.get());
View Full Code Here

Examples of org.apache.openejb.junit.TestInstance

    private static void ensureInit() {
        if (!initialized) {
            synchronized (MockRegistry.class) {
                if (!initialized) {
                    final TestInstance instance = SystemInstance.get().getComponent(TestInstance.class);
                    if (instance != null) {
                        Class<?> current = instance.getTestClass();
                        while (!current.equals(Object.class)) {
                            for (Field f : current.getDeclaredFields()) {
                                for (Annotation annotation : f.getAnnotations()) {
                                    if (annotation.annotationType().getName().startsWith("org.mockito.")) {
                                        final boolean acc = f.isAccessible();
                                        try {
                                            f.setAccessible(true);
                                            final Object mockInstance = f.get(instance.getInstance());

                                            if (Mock.class.equals(annotation.annotationType())) {
                                                final Mock mock = (Mock) annotation;
                                                if (!"".equals(mock.name())) {
                                                    mockInstancesByName.put(mock.name(), mockInstance);
View Full Code Here

Examples of org.apache.openejb.testing.TestInstance

                }
                clazz = clazz.getSuperclass();
            }
        }
        if (test != null) {
            SystemInstance.get().setComponent(TestInstance.class, new TestInstance(test.getClass(), test));
            SystemInstance.get().getComponent(FallbackPropertyInjector.class); // force eager init (MockitoInjector initialize eveything in its constructor)
            Injector.inject(test);
        }
        if (statement != null) {
            statement.evaluate();
View Full Code Here

Examples of org.apache.openejb.testing.TestInstance

    private static void ensureInit() {
        if (!initialized) {
            synchronized (MockRegistry.class) {
                if (!initialized) {
                    final TestInstance instance = SystemInstance.get().getComponent(TestInstance.class);
                    if (instance != null) {
                        Class<?> current = instance.getTestClass();
                        while (!current.equals(Object.class)) {
                            for (Field f : current.getDeclaredFields()) {
                                for (Annotation annotation : f.getAnnotations()) {
                                    if (annotation.annotationType().getName().startsWith("org.mockito.")) {
                                        final boolean acc = f.isAccessible();
                                        try {
                                            f.setAccessible(true);
                                            final Object mockInstance = f.get(instance.getInstance());

                                            if (Mock.class.equals(annotation.annotationType())) {
                                                final Mock mock = (Mock) annotation;
                                                if (!"".equals(mock.name())) {
                                                    mockInstancesByName.put(mock.name(), mockInstance);
View Full Code Here

Examples of org.apache.qpid.disttest.controller.config.TestInstance

    }


    private TestInstance createTestInstanceWithOneParticipant()
    {
        TestInstance testInstance = mock(TestInstance.class);

        List<CommandForClient> commands = Arrays.asList(
                new CommandForClient(CLIENT1_CONFIGURED_NAME, new NoOpCommand()));

        when(testInstance.createCommands()).thenReturn(commands);

        when(testInstance.getTotalNumberOfParticipants()).thenReturn(1);

        when(testInstance.getName()).thenReturn(TEST_NAME);

        List<QueueConfig> queues = mock(List.class);
        when(testInstance.getQueues()).thenReturn(queues);

        when(testInstance.getIterationNumber()).thenReturn(ITERATION_NUMBER);

        return testInstance;
    }
View Full Code Here

Examples of org.apache.qpid.disttest.controller.config.TestInstance

        return testInstance;
    }

    private TestInstance createTestInstanceWithConnection()
    {
        TestInstance testInstance = mock(TestInstance.class);

        List<CommandForClient> commands = Arrays.asList(
                new CommandForClient(CLIENT1_CONFIGURED_NAME, new CreateConnectionCommand("conn1", "factory")));

        when(testInstance.createCommands()).thenReturn(commands);

        return testInstance;
    }
View Full Code Here

Examples of org.apache.qpid.disttest.controller.config.TestInstance

    }

    private Config createSimpleConfig()
    {
        Config config = mock(Config.class);
        TestInstance testInstance = mock(TestInstance.class);

        List<TestInstance> testInstances = Arrays.asList(testInstance);

        when(config.getTests()).thenReturn(testInstances);
        when(config.getTotalNumberOfClients()).thenReturn(1); // necessary otherwise controller rejects "invalid" config
View Full Code Here

Examples of org.apache.qpid.disttest.controller.config.TestInstance

    }

    private Config createSimpleConfig()
    {
        Config config = mock(Config.class);
        TestInstance testInstance = mock(TestInstance.class);

        List<TestInstance> testInstances = Arrays.asList(testInstance);

        when(config.getTests()).thenReturn(testInstances);
        when(config.getTotalNumberOfClients()).thenReturn(1); // necessary otherwise controller rejects "invalid" config
View Full Code Here

Examples of org.apache.qpid.disttest.controller.config.TestInstance

    }


    private TestInstance createTestInstanceWithOneParticipant()
    {
        TestInstance testInstance = mock(TestInstance.class);

        List<CommandForClient> commands = Arrays.asList(
                new CommandForClient(CLIENT1_CONFIGURED_NAME, new NoOpCommand()));

        when(testInstance.createCommands()).thenReturn(commands);

        when(testInstance.getTotalNumberOfParticipants()).thenReturn(1);

        when(testInstance.getName()).thenReturn(TEST_NAME);

        List<QueueConfig> queues = mock(List.class);
        when(testInstance.getQueues()).thenReturn(queues);

        when(testInstance.getIterationNumber()).thenReturn(ITERATION_NUMBER);

        return testInstance;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.