//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldHandleBranchedStoreWhenHandshakeFailsWithBranchedDataException() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldHandleBranchedStoreWhenHandshakeFailsWithBranchedDataException() { // Given SwitchToSlaveBranchThenCopy switchToSlave = NewSwitchToSlaveSpy(); URI masterUri = new URI("cluster://localhost?serverId=1"); URI me = new URI("cluster://localhost?serverId=2"); MasterClient masterClient = mock(typeof(MasterClient)); when(masterClient.Handshake(anyLong(), any(typeof(StoreId)))).thenThrow(new BranchedDataException("")); TransactionIdStore transactionIdStore = mock(typeof(TransactionIdStore)); when(transactionIdStore.LastCommittedTransaction).thenReturn(new TransactionId(42, 42, 42)); when(transactionIdStore.LastCommittedTransactionId).thenReturn(Org.Neo4j.Kernel.impl.transaction.log.TransactionIdStore_Fields.BASE_TX_ID); // When try { switchToSlave.CheckDataConsistency(masterClient, transactionIdStore, _storeId, masterUri, me, Org.Neo4j.Helpers.CancellationRequest_Fields.NeverCancelled); fail("Should have thrown " + typeof(BranchedDataException).Name + " exception"); } catch (BranchedDataException) { // good we got the expected exception } // Then verify(switchToSlave).stopServicesAndHandleBranchedStore(any(typeof(BranchedDataPolicy))); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test @SuppressWarnings("unchecked") public void shouldHandleBranchedStoreWhenMyStoreIdDiffersFromMasterStoreId() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldHandleBranchedStoreWhenMyStoreIdDiffersFromMasterStoreId() { // Given SwitchToSlaveBranchThenCopy switchToSlave = NewSwitchToSlaveSpy(); URI me = new URI("cluster://localhost?serverId=2"); MasterClient masterClient = mock(typeof(MasterClient)); Response <HandshakeResult> response = mock(typeof(Response)); when(response.ResponseConflict()).thenReturn(new HandshakeResult(1, 2)); when(masterClient.Handshake(anyLong(), any(typeof(StoreId)))).thenReturn(response); StoreId storeId = newStoreIdForCurrentVersion(1, 2, 3, 4); TransactionIdStore transactionIdStore = mock(typeof(TransactionIdStore)); when(transactionIdStore.LastCommittedTransaction).thenReturn(new TransactionId(42, 42, 42)); when(transactionIdStore.LastCommittedTransactionId).thenReturn(Org.Neo4j.Kernel.impl.transaction.log.TransactionIdStore_Fields.BASE_TX_ID); // When try { switchToSlave.CheckDataConsistency(masterClient, transactionIdStore, storeId, new URI("cluster://localhost?serverId=1"), me, Org.Neo4j.Helpers.CancellationRequest_Fields.NeverCancelled); fail("Should have thrown " + typeof(MismatchingStoreIdException).Name + " exception"); } catch (MismatchingStoreIdException) { // good we got the expected exception } // Then verify(switchToSlave).stopServicesAndHandleBranchedStore(any(typeof(BranchedDataPolicy))); }