コード例 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldPerformSuccessfulStoreCopyProcess() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldPerformSuccessfulStoreCopyProcess()
        {
            // given
            StoreStreamingProcess process = new StoreStreamingProcess(_protocol, _checkPointerSupplier, _mutex, _resourceStream);

            // mocked behaviour
            ImmediateEventExecutor eventExecutor     = ImmediateEventExecutor.INSTANCE;
            Promise <Void>         completionPromise = eventExecutor.newPromise();
            long lastCheckpointedTxId = 1000L;
            RawCursor <StoreResource, IOException> resources = rawCursorOf();

            when(_checkPointer.tryCheckPoint(any())).thenReturn(lastCheckpointedTxId);
            when(_checkPointer.lastCheckPointedTransactionId()).thenReturn(lastCheckpointedTxId);
            when(_protocol.end(_ctx, SUCCESS)).thenReturn(completionPromise);
            when(_resourceStream.create()).thenReturn(resources);

            // when
            process.Perform(_ctx);

            // then
            InOrder inOrder = Mockito.inOrder(_protocol, _checkPointer);

            inOrder.verify(_checkPointer).tryCheckPoint(any());
            inOrder.verify(_protocol).end(_ctx, SUCCESS);
            inOrder.verifyNoMoreInteractions();

            assertEquals(1, @lock.ReadLockCount);

            // when
            completionPromise.Success = null;

            // then
            assertEquals(0, @lock.ReadLockCount);
        }
コード例 #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private org.neo4j.upgrade.loader.EmbeddedJarLoader createJarLoader() throws ClassNotFoundException, java.io.IOException
        private EmbeddedJarLoader CreateJarLoader()
        {
            EmbeddedJarLoader jarLoader = Mockito.mock(typeof(EmbeddedJarLoader));

            when(jarLoader.LoadEmbeddedClass(anyString())).thenReturn(typeof(UpgraderStub));
            return(jarLoader);
        }
コード例 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldDropMessagesIfHasNotBeenStarted()
        public virtual void ShouldDropMessagesIfHasNotBeenStarted()
        {
            // when
            _handler.handle(_heartbeat);

            // then
            verify(@delegate, Mockito.never()).handle(_heartbeat);
        }
コード例 #4
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: private static ProcessEnginePlugin processEnginePlugin(final String name)
        private static ProcessEnginePlugin processEnginePlugin(string name)
        {
            ProcessEnginePlugin plugin = Mockito.mock(typeof(ProcessEnginePlugin));

            when(plugin.ToString()).thenReturn(name);

            return(plugin);
        }
コード例 #5
0
        //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
        //ORIGINAL LINE: @Before public void setUp()
        public virtual void SetUp()
        {
            _master = mock( typeof( Master ), new LockedOnMasterAnswer() );
              _lockManager = new ForsetiLockManager( Config.defaults(), Clocks.systemClock(), ResourceTypes.values() );
              _requestContextFactory = mock( typeof( RequestContextFactory ) );
              _databaseAvailabilityGuard = new DatabaseAvailabilityGuard( GraphDatabaseSettings.DEFAULT_DATABASE_NAME, Clocks.systemClock(), mock(typeof(Log)) );

              when( _requestContextFactory.newRequestContext( Mockito.anyInt() ) ).thenReturn(RequestContext.anonymous(1));
        }
コード例 #6
0
        public virtual void testPluginRegistersJsonSerializerIfPresentInClasspath()
        {
            DataFormats.loadDataFormats(null);
            ProcessEngineConfigurationImpl mockConfig = Mockito.mock(typeof(ProcessEngineConfigurationImpl));

            Mockito.when(mockConfig.VariableSerializers).thenReturn(processEngineConfiguration.VariableSerializers);
            (new SpinProcessEnginePlugin()).registerSerializers(mockConfig);

            assertTrue(processEngineConfiguration.VariableSerializers.getSerializerByName(org.camunda.spin.plugin.variable.type.JsonValueType_Fields.TYPE_NAME) is JsonValueSerializer);
        }
コード例 #7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testLogPruneThresholdsByType()
        public virtual void TestLogPruneThresholdsByType()
        {
            FileSystemAbstraction fsa = Mockito.mock(typeof(FileSystemAbstraction));
            Clock clock = Clocks.systemClock();

            assertThat(getThresholdByType(fsa, clock, new ThresholdConfigValue("files", 25), ""), instanceOf(typeof(FileCountThreshold)));
            assertThat(getThresholdByType(fsa, clock, new ThresholdConfigValue("size", 16000), ""), instanceOf(typeof(FileSizeThreshold)));
            assertThat(getThresholdByType(fsa, clock, new ThresholdConfigValue("txs", 4000), ""), instanceOf(typeof(EntryCountThreshold)));
            assertThat(getThresholdByType(fsa, clock, new ThresholdConfigValue("entries", 4000), ""), instanceOf(typeof(EntryCountThreshold)));
            assertThat(getThresholdByType(fsa, clock, new ThresholdConfigValue("hours", 100), ""), instanceOf(typeof(EntryTimespanThreshold)));
            assertThat(getThresholdByType(fsa, clock, new ThresholdConfigValue("days", 100_000), ""), instanceOf(typeof(EntryTimespanThreshold)));
        }
コード例 #8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldDropMessagesIfForDifferentClusterId() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldDropMessagesIfForDifferentClusterId()
        {
            // given
            _handler.start(_clusterId);

            // when
            _handler.handle(Org.Neo4j.causalclustering.core.consensus.RaftMessages_ReceivedInstantClusterIdAwareMessage.of(Instant.now(), new ClusterId(System.Guid.randomUUID()), new Org.Neo4j.causalclustering.core.consensus.RaftMessages_Heartbeat(new MemberId(System.Guid.randomUUID()), 0L, 0, 0)
                                                                                                                           ));

            // then
            verify(@delegate, Mockito.never()).handle(ArgumentMatchers.any(typeof(Org.Neo4j.causalclustering.core.consensus.RaftMessages_ReceivedInstantClusterIdAwareMessage)));
        }
コード例 #9
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldDropMessagesIfHasBeenStopped() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldDropMessagesIfHasBeenStopped()
        {
            // given
            _handler.start(_clusterId);
            _handler.stop();

            // when
            _handler.handle(_heartbeat);

            // then
            verify(@delegate, Mockito.never()).handle(_heartbeat);
        }
コード例 #10
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldCleanExistentLockSessionOnFinishOffChannel()
        public virtual void ShouldCleanExistentLockSessionOnFinishOffChannel()
        {
            Master master = mock(typeof(Master));
            ConversationManager conversationManager = mock(typeof(ConversationManager));
            LogEntryReader <ReadableClosablePositionAwareChannel> logEntryReader = new VersionAwareLogEntryReader <ReadableClosablePositionAwareChannel>();
            MasterServer   masterServer   = new MasterServer(master, mock(typeof(LogProvider)), mock(typeof(Server.Configuration)), mock(typeof(TxChecksumVerifier)), mock(typeof(ByteCounterMonitor)), mock(typeof(RequestMonitor)), conversationManager, logEntryReader);
            RequestContext requestContext = new RequestContext(1L, 1, 1, 0, 0L);

            masterServer.StopConversation(requestContext);

            Mockito.verify(conversationManager).stop(requestContext);
        }
コード例 #11
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void allocateReusableRecordsAndSwitchToDefaultWhenExhausted()
        public virtual void AllocateReusableRecordsAndSwitchToDefaultWhenExhausted()
        {
            DynamicRecord          dynamicRecord1  = new DynamicRecord(1);
            DynamicRecord          dynamicRecord2  = new DynamicRecord(2);
            DynamicRecordAllocator recordAllocator = mock(typeof(DynamicRecordAllocator));

            Mockito.when(recordAllocator.NextRecord()).thenReturn(dynamicRecord2);
            ReusableRecordsCompositeAllocator compositeAllocator = new ReusableRecordsCompositeAllocator(singletonList(dynamicRecord1), recordAllocator);

            assertSame("Same as pre allocated record.", dynamicRecord1, compositeAllocator.NextRecord());
            assertSame("Same as expected allocated record.", dynamicRecord2, compositeAllocator.NextRecord());
        }
コード例 #12
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testPluginDoesNotRegisterJsonSerializerIfNotPresentInClasspath() throws java.io.IOException
        public virtual void testPluginDoesNotRegisterJsonSerializerIfNotPresentInClasspath()
        {
            ClassLoader mockClassloader = Mockito.mock(typeof(ClassLoader));

            Mockito.when(mockClassloader.getResources(Mockito.anyString())).thenReturn(Collections.enumeration(System.Linq.Enumerable.Empty <URL>()));
            DataFormats.loadDataFormats(mockClassloader);
            ProcessEngineConfigurationImpl mockConfig  = Mockito.mock(typeof(ProcessEngineConfigurationImpl));
            DefaultVariableSerializers     serializers = new DefaultVariableSerializers();

            Mockito.when(mockConfig.VariableSerializers).thenReturn(serializers);
            (new SpinProcessEnginePlugin()).registerSerializers(mockConfig);

            assertTrue(serializers.getSerializerByName(org.camunda.spin.plugin.variable.type.JsonValueType_Fields.TYPE_NAME) == null);
        }
コード例 #13
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testSucceess()
        public virtual void testSucceess()
        {
            // given
            foo.getFoo();
            foo.Bar;

            // when
            InOrder inOrder = Mockito.inOrder(foo);

            inOrder.verify(foo).Foo;

            // then
            inOrder.verify(foo, immediatelyAfter()).Bar;
        }
コード例 #14
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testForceFlush()
        public virtual void TestForceFlush()
        {
            DirectRecordAccessSet recordAccessSet = Mockito.mock(typeof(DirectRecordAccessSet));

            BatchInserterImpl.BatchedFlushStrategy flushStrategy = CreateFlushStrategy(recordAccessSet, 2);

            flushStrategy.ForceFlush();
            flushStrategy.ForceFlush();
            Mockito.verify(recordAccessSet, Mockito.times(2)).commit();

            flushStrategy.Flush();
            flushStrategy.ForceFlush();
            Mockito.verify(recordAccessSet, Mockito.times(3)).commit();
        }
コード例 #15
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void startJobTransactionMonitor()
        internal virtual void StartJobTransactionMonitor()
        {
            JobHandle jobHandle = Mockito.mock(typeof(JobHandle));

            when(_jobScheduler.scheduleRecurring(eq(Group.TRANSACTION_TIMEOUT_MONITOR), eq(_transactionMonitor), anyLong(), any(typeof(TimeUnit)))).thenReturn(jobHandle);

            KernelTransactionMonitorScheduler monitorScheduler = new KernelTransactionMonitorScheduler(_transactionMonitor, _jobScheduler, 7);

            monitorScheduler.Start();
            verify(_jobScheduler).scheduleRecurring(Group.TRANSACTION_TIMEOUT_MONITOR, _transactionMonitor, 7, TimeUnit.MILLISECONDS);

            monitorScheduler.Stop();
            verify(jobHandle).cancel(true);
        }
コード例 #16
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldRegisterItselfOnListeners()
        public virtual void ShouldRegisterItselfOnListeners()
        {
            // given
            Cluster             cluster             = mock(typeof(Cluster));
            Heartbeat           heartbeat           = mock(typeof(Heartbeat));
            ClusterMemberEvents clusterMemberEvents = mock(typeof(ClusterMemberEvents));

            // when
            new ObservedClusterMembers(_logProvider, cluster, heartbeat, clusterMemberEvents, null);

            // then
            verify(cluster).addClusterListener(Mockito.any());
            verify(heartbeat).addHeartbeatListener(Mockito.any());
            verify(clusterMemberEvents).addClusterMemberListener(Mockito.any());
        }
コード例 #17
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void dumpStoreShouldPrintShorterMessageForAllZeroBuffer()
        internal virtual void DumpStoreShouldPrintShorterMessageForAllZeroBuffer()
        {
            // Given
            MemoryStream       outStream = new MemoryStream();
            PrintStream        @out      = new PrintStream(outStream);
            DumpStore          dumpStore = new DumpStore(@out);
            ByteBuffer         buffer    = ByteBuffer.allocate(1024);
            AbstractBaseRecord record    = Mockito.mock(typeof(AbstractBaseRecord));

            // When
            //when( record.inUse() ).thenReturn( true );
            dumpStore.dumpHex(record, buffer, 2, 4);

            // Then
            assertEquals(format(": all zeros @ 0x8 - 0xc%n"), outStream.ToString());
        }
コード例 #18
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldExcludeChannelsWithoutInstalledProtocol()
        public virtual void ShouldExcludeChannelsWithoutInstalledProtocol()
        {
            // given
            _reconnectingChannels.putIfAbsent(_to1, _channel1);
            _reconnectingChannels.putIfAbsent(_to2, _channel2);
            ProtocolStack protocolStack1 = new ProtocolStack(TestProtocols_TestApplicationProtocols.RAFT_3, emptyList());

            Mockito.when(_channel1.installedProtocolStack()).thenReturn(protocolStack1);
            Mockito.when(_channel2.installedProtocolStack()).thenReturn(null);

            // when
            Stream <Pair <AdvertisedSocketAddress, ProtocolStack> > installedProtocols = _reconnectingChannels.installedProtocols();

            // then
            assertThat(installedProtocols, contains(Pair.of(_to1, protocolStack1)));
        }
コード例 #19
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReleaseNotAcquiredLocks()
        public virtual void ShouldReleaseNotAcquiredLocks()
        {
            // given
            LockResource    node            = new LockResource(ResourceTypes.NODE, 1L);
            LockTransaction lockTransaction = new LockTransaction();
            RWLock          rwLock          = Mockito.mock(typeof(RWLock));
            LockManagerImpl lockManager     = new MockedLockLockManager(this, new RagManager(), rwLock);

            // expect
            lockManager.TryReadLock(node, lockTransaction);

            // during client close any of the attempts to get read/write lock can be scheduled as last one
            // in that case lock will hot have marks, readers, writers anymore and optimistically created lock
            // need to be removed from global map resource map
            assertEquals(0, CountLocks(lockManager));
        }
コード例 #20
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void givenAccessGuardWithConditionWhenShutdownThenInstantlyDenyAccess()
        public virtual void GivenAccessGuardWithConditionWhenShutdownThenInstantlyDenyAccess()
        {
            // Given
            Clock clock = Mockito.mock(typeof(Clock));
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.kernel.availability.DatabaseAvailabilityGuard databaseAvailabilityGuard = getDatabaseAvailabilityGuard(clock, org.neo4j.logging.NullLog.getInstance());
            DatabaseAvailabilityGuard databaseAvailabilityGuard = GetDatabaseAvailabilityGuard(clock, NullLog.Instance);

            databaseAvailabilityGuard.Require(_requirement_1);

            // When
            databaseAvailabilityGuard.Shutdown();

            // Then
            assertFalse(databaseAvailabilityGuard.IsAvailable(1000));
            verifyZeroInteractions(clock);
        }
コード例 #21
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testResetBatchCounterOnForce()
        public virtual void TestResetBatchCounterOnForce()
        {
            DirectRecordAccessSet recordAccessSet = Mockito.mock(typeof(DirectRecordAccessSet));

            BatchInserterImpl.BatchedFlushStrategy flushStrategy = CreateFlushStrategy(recordAccessSet, 3);

            flushStrategy.Flush();
            flushStrategy.Flush();
            Mockito.verifyZeroInteractions(recordAccessSet);

            flushStrategy.ForceFlush();
            Mockito.verify(recordAccessSet).commit();
            Mockito.verifyNoMoreInteractions(recordAccessSet);

            flushStrategy.Flush();
            flushStrategy.Flush();
        }
コード例 #22
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReturnStreamOfInstalledProtocolsForChannelsThatHaveCompletedHandshake()
        public virtual void ShouldReturnStreamOfInstalledProtocolsForChannelsThatHaveCompletedHandshake()
        {
            // given
            _reconnectingChannels.putIfAbsent(_to1, _channel1);
            _reconnectingChannels.putIfAbsent(_to2, _channel2);
            ProtocolStack protocolStack1 = new ProtocolStack(TestProtocols_TestApplicationProtocols.RAFT_3, emptyList());
            ProtocolStack protocolStack2 = new ProtocolStack(TestProtocols_TestApplicationProtocols.RAFT_2, emptyList());

            Mockito.when(_channel1.installedProtocolStack()).thenReturn(protocolStack1);
            Mockito.when(_channel2.installedProtocolStack()).thenReturn(protocolStack2);

            // when
            Stream <Pair <AdvertisedSocketAddress, ProtocolStack> > installedProtocols = _reconnectingChannels.installedProtocols();

            // then
            Stream <Pair <AdvertisedSocketAddress, ProtocolStack> > sorted = installedProtocols.sorted(System.Collections.IComparer.comparing(p => p.first().Hostname));

            assertThat(sorted, contains(Pair.of(_to1, protocolStack1), Pair.of(_to2, protocolStack2)));
        }
コード例 #23
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldPrintDiskUsage()
        public virtual void ShouldPrintDiskUsage()
        {
            // Not sure how to get around this w/o spying. The method that we're unit testing will construct
            // other File instances with this guy as parent and internally the File constructor uses the field 'path'
            // which, if purely mocked, won't be assigned. At the same time we want to control the total/free space methods
            // and what they return... a tough one.
            File           storeDir = Mockito.spy(new File("storeDir"));
            DatabaseLayout layout   = mock(typeof(DatabaseLayout));

            when(layout.DatabaseDirectory()).thenReturn(storeDir);
            when(storeDir.TotalSpace).thenReturn(100L);
            when(storeDir.FreeSpace).thenReturn(40L);

            AssertableLogProvider logProvider = new AssertableLogProvider();

            KernelDiagnostics.StoreFiles storeFiles = new KernelDiagnostics.StoreFiles(layout);
            storeFiles.Dump(logProvider.getLog(this.GetType()).debugLogger());

            logProvider.RawMessageMatcher().assertContains("100 / 40 / 40");
        }
コード例 #24
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testFailureWhenInvocationNotPresentCase2()
        public virtual void testFailureWhenInvocationNotPresentCase2()
        {
            // given
            foo.getFoo();

            // when
            InOrder inOrder = Mockito.inOrder(foo);

            inOrder.verify(foo).Foo;

            // then
            try
            {
                inOrder.verify(foo, immediatelyAfter()).Bar;
                Assert.fail("should not verify");
            }
            catch (MockitoAssertionError)
            {
                // happy path
            }
        }
コード例 #25
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldLogAndDumpData() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldLogAndDumpData()
        {
            // given
            DatabaseLayout        databaseLayout = this.Directory.databaseLayout();
            LabelScanWriteMonitor writeMonitor   = new LabelScanWriteMonitor(Fs, databaseLayout);
            LabelScanValue        value          = new LabelScanValue();

            writeMonitor.Range(3, 0);
            writeMonitor.PrepareAdd(123, 4);
            writeMonitor.PrepareAdd(123, 5);
            writeMonitor.MergeAdd(new LabelScanValue(), value.Set(4).set(5));
            writeMonitor.FlushPendingUpdates();
            writeMonitor.PrepareRemove(124, 5);
            writeMonitor.MergeRemove(value, (new LabelScanValue()).Set(5));
            writeMonitor.WriteSessionEnded();
            writeMonitor.Range(5, 1);
            writeMonitor.PrepareAdd(125, 10);
            writeMonitor.MergeAdd((new LabelScanValue()).Set(9), (new LabelScanValue()).Set(10));
            writeMonitor.FlushPendingUpdates();
            writeMonitor.WriteSessionEnded();
            writeMonitor.Close();

            // when
            LabelScanWriteMonitor.Dumper dumper = mock(typeof(LabelScanWriteMonitor.Dumper));
            LabelScanWriteMonitor.Dump(Fs, databaseLayout, dumper, null);

            // then
            InOrder inOrder = Mockito.inOrder(dumper);

            inOrder.verify(dumper).prepare(true, 0, 0, 123, 64 * 3 + 4, 0);
            inOrder.verify(dumper).prepare(true, 0, 0, 123, 64 * 3 + 5, 0);
            inOrder.verify(dumper).merge(true, 0, 0, 3, 0, 0, 0b00000000_0000000_00000000_00000000__00000000_00000000_00000000_00110000);
            inOrder.verify(dumper).prepare(false, 0, 1, 124, 64 * 3 + 5, 0);
            inOrder.verify(dumper).merge(false, 0, 1, 3, 0, 0b00000000_0000000_00000000_00000000__00000000_00000000_00000000_00110000, 0b00000000_0000000_00000000_00000000__00000000_00000000_00000000_00100000);
            inOrder.verify(dumper).prepare(true, 1, 0, 125, 64 * 5 + 10, 1);
            inOrder.verify(dumper).merge(true, 1, 0, 5, 1, 0b00000000_0000000_00000000_00000000__00000000_00000000_00000010_00000000, 0b00000000_0000000_00000000_00000000__00000000_00000000_00000100_00000000);
            inOrder.verifyNoMoreInteractions();
        }
コード例 #26
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void dumpStoreShouldPrintBufferWithContent()
        internal virtual void DumpStoreShouldPrintBufferWithContent()
        {
            // Given
            MemoryStream outStream = new MemoryStream();
            PrintStream  @out      = new PrintStream(outStream);
            DumpStore    dumpStore = new DumpStore(@out);
            ByteBuffer   buffer    = ByteBuffer.allocate(1024);

            for (sbyte i = 0; i < 10; i++)
            {
                buffer.put(i);
            }
            buffer.flip();

            AbstractBaseRecord record = Mockito.mock(typeof(AbstractBaseRecord));

            // When
            //when( record.inUse() ).thenReturn( true );
            dumpStore.dumpHex(record, buffer, 2, 4);

            // Then
            assertEquals(format("@ 0x00000008: 00 01 02 03  04 05 06 07  08 09%n"), outStream.ToString());
        }
コード例 #27
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldLetGatedMessagesPassOnSuccess() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldLetGatedMessagesPassOnSuccess()
        {
            // given
            ChannelPromise promiseA = mock(typeof(ChannelPromise));
            ChannelPromise promiseB = mock(typeof(ChannelPromise));
            ChannelPromise promiseC = mock(typeof(ChannelPromise));

            _gate.write(_ctx, "A", promiseA);
            _gate.write(_ctx, "B", promiseB);
            _gate.write(_ctx, "C", promiseC);
            verify(_ctx, never()).write(any(), any());

            // when
            _gate.userEventTriggered(_ctx, GateEvent.Success);

            // then
            InOrder inOrder = Mockito.inOrder(_ctx);

            inOrder.verify(_ctx).write("A", promiseA);
            inOrder.verify(_ctx).write("B", promiseB);
            inOrder.verify(_ctx).write("C", promiseC);
            inOrder.verify(_ctx, never()).write(any(), any());
        }
コード例 #28
0
 internal LockedOnMasterAnswer()
 {
     LockResult = Mockito.mock( typeof( Response ) );
         when( LockResult.response() ).thenReturn(new LockResult(LockStatus.OkLocked));
 }
コード例 #29
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setUp()
        public virtual void setUp()
        {
            foo = Mockito.mock(typeof(Foo));
        }
コード例 #30
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setUp()
        public virtual void SetUp()
        {
            _request = Mockito.mock(typeof(HttpServletRequest));
        }