當前位置: 首頁>>代碼示例>>Java>>正文


Java Mockery.assertIsSatisfied方法代碼示例

本文整理匯總了Java中org.jmock.Mockery.assertIsSatisfied方法的典型用法代碼示例。如果您正苦於以下問題:Java Mockery.assertIsSatisfied方法的具體用法?Java Mockery.assertIsSatisfied怎麽用?Java Mockery.assertIsSatisfied使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.jmock.Mockery的用法示例。


在下文中一共展示了Mockery.assertIsSatisfied方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testEmptyFramesAreSkipped

import org.jmock.Mockery; //導入方法依賴的package包/類
@Test
public void testEmptyFramesAreSkipped() throws Exception {
	Mockery context = new Mockery();
	final StreamDecrypter decrypter = context.mock(StreamDecrypter.class);
	context.checking(new Expectations() {{
		oneOf(decrypter).readFrame(with(any(byte[].class)));
		will(returnValue(0)); // Empty frame
		oneOf(decrypter).readFrame(with(any(byte[].class)));
		will(returnValue(2)); // Non-empty frame with two payload bytes
		oneOf(decrypter).readFrame(with(any(byte[].class)));
		will(returnValue(0)); // Empty frame
		oneOf(decrypter).readFrame(with(any(byte[].class)));
		will(returnValue(-1)); // No more frames
	}});
	StreamReaderImpl r = new StreamReaderImpl(decrypter);
	assertEquals(0, r.read()); // Skip the first empty frame, read a byte
	assertEquals(0, r.read()); // Read another byte
	assertEquals(-1, r.read()); // Skip the second empty frame, reach EOF
	assertEquals(-1, r.read()); // Still at EOF
	context.assertIsSatisfied();
	r.close();
}
 
開發者ID:rafjordao,項目名稱:Nird2,代碼行數:23,代碼來源:StreamReaderImplTest.java

示例2: testMultipleReadsPerFrameWithOffsets

import org.jmock.Mockery; //導入方法依賴的package包/類
@Test
public void testMultipleReadsPerFrameWithOffsets() throws Exception {
	Mockery context = new Mockery();
	final StreamDecrypter decrypter = context.mock(StreamDecrypter.class);
	context.checking(new Expectations() {{
		oneOf(decrypter).readFrame(with(any(byte[].class)));
		will(returnValue(MAX_PAYLOAD_LENGTH)); // Nice long frame
		oneOf(decrypter).readFrame(with(any(byte[].class)));
		will(returnValue(-1)); // No more frames
	}});
	StreamReaderImpl r = new StreamReaderImpl(decrypter);
	byte[] buf = new byte[MAX_PAYLOAD_LENGTH];
	// Read the first half of the payload
	assertEquals(MAX_PAYLOAD_LENGTH / 2, r.read(buf, MAX_PAYLOAD_LENGTH / 2,
			MAX_PAYLOAD_LENGTH / 2));
	// Read the second half of the payload
	assertEquals(MAX_PAYLOAD_LENGTH / 2, r.read(buf, 123,
			MAX_PAYLOAD_LENGTH / 2));
	// Reach EOF
	assertEquals(-1, r.read(buf, 0, buf.length));
	context.assertIsSatisfied();
	r.close();
}
 
開發者ID:rafjordao,項目名稱:Nird2,代碼行數:24,代碼來源:StreamReaderImplTest.java

示例3: testCannotStartTransactionDuringTransaction

import org.jmock.Mockery; //導入方法依賴的package包/類
private void testCannotStartTransactionDuringTransaction(
		boolean firstTxnReadOnly, boolean secondTxnReadOnly)
		throws Exception {
	Mockery context = new Mockery();
	@SuppressWarnings("unchecked")
	final Database<Object> database = context.mock(Database.class);
	final ShutdownManager shutdown = context.mock(ShutdownManager.class);
	final EventBus eventBus = context.mock(EventBus.class);

	context.checking(new Expectations() {{
		oneOf(database).startTransaction();
		will(returnValue(txn));
	}});

	DatabaseComponent db = createDatabaseComponent(database, eventBus,
			shutdown);

	assertNotNull(db.startTransaction(firstTxnReadOnly));
	try {
		db.startTransaction(secondTxnReadOnly);
		fail();
	} finally {
		context.assertIsSatisfied();
	}
}
 
開發者ID:rafjordao,項目名稱:Nird2,代碼行數:26,代碼來源:DatabaseComponentImplTest.java

示例4: testWriterIsNullIfOutputDirIsAFile

import org.jmock.Mockery; //導入方法依賴的package包/類
@Test
public void testWriterIsNullIfOutputDirIsAFile() throws Exception {
	final File drive1 = new File(testDir, "1");
	final File drive2 = new File(testDir, "2");
	final List<File> drives = new ArrayList<>();
	drives.add(drive1);
	drives.add(drive2);
	// Create drive1 as a file rather than a directory
	assertTrue(drive1.createNewFile());

	Mockery context = new Mockery() {{
		setThreadingPolicy(new Synchroniser());
	}};
	final Executor executor = context.mock(Executor.class);
	final SimplexPluginCallback callback =
			context.mock(SimplexPluginCallback.class);
	final RemovableDriveFinder finder =
			context.mock(RemovableDriveFinder.class);
	final RemovableDriveMonitor monitor =
			context.mock(RemovableDriveMonitor.class);

	context.checking(new Expectations() {{
		oneOf(monitor).start(with(any(Callback.class)));
		oneOf(finder).findRemovableDrives();
		will(returnValue(drives));
		oneOf(callback).showChoice(with(any(String[].class)),
				with(any(String[].class)));
		will(returnValue(0)); // The user chose drive1 but it's not a dir
	}});

	RemovableDrivePlugin plugin = new RemovableDrivePlugin(executor,
			callback, finder, monitor, 0);
	plugin.start();

	assertNull(plugin.createWriter(contactId));
	File[] files = drive1.listFiles();
	assertTrue(files == null || files.length == 0);

	context.assertIsSatisfied();
}
 
開發者ID:rafjordao,項目名稱:Nird2,代碼行數:41,代碼來源:RemovableDrivePluginTest.java

示例5: testCreateConnection

import org.jmock.Mockery; //導入方法依賴的package包/類
@Test
public void testCreateConnection() throws Exception {
	Mockery context = new Mockery();
	final ModemFactory modemFactory = context.mock(ModemFactory.class);
	final SerialPortList serialPortList =
			context.mock(SerialPortList.class);
	final DuplexPluginCallback callback =
			context.mock(DuplexPluginCallback.class);
	final ModemPlugin plugin = new ModemPlugin(modemFactory,
			serialPortList, callback, 0);
	final Modem modem = context.mock(Modem.class);
	final TransportProperties local = new TransportProperties();
	local.put("iso3166", ISO_1336);
	TransportProperties p = new TransportProperties();
	p.put("iso3166", ISO_1336);
	p.put("number", NUMBER);
	ContactId contactId = new ContactId(234);
	final Map<ContactId, TransportProperties> remote =
			Collections.singletonMap(contactId, p);
	context.checking(new Expectations() {{
		// start()
		oneOf(serialPortList).getPortNames();
		will(returnValue(new String[] { "foo" }));
		oneOf(modemFactory).createModem(plugin, "foo");
		will(returnValue(modem));
		oneOf(modem).start();
		will(returnValue(true));
		// createConnection()
		oneOf(callback).getLocalProperties();
		will(returnValue(local));
		oneOf(callback).getRemoteProperties();
		will(returnValue(remote));
		oneOf(modem).dial(NUMBER);
		will(returnValue(true));
	}});
	plugin.start();
	// A connection should be returned
	assertNotNull(plugin.createConnection(contactId));
	context.assertIsSatisfied();
}
 
開發者ID:rafjordao,項目名稱:Nird2,代碼行數:41,代碼來源:ModemPluginTest.java

示例6: testCannotAddDuplicateContact

import org.jmock.Mockery; //導入方法依賴的package包/類
@Test
public void testCannotAddDuplicateContact() throws Exception {
	Mockery context = new Mockery();
	@SuppressWarnings("unchecked")
	final Database<Object> database = context.mock(Database.class);
	final ShutdownManager shutdown = context.mock(ShutdownManager.class);
	final EventBus eventBus = context.mock(EventBus.class);

	context.checking(new Expectations() {{
		oneOf(database).startTransaction();
		will(returnValue(txn));
		oneOf(database).containsLocalAuthor(txn, localAuthorId);
		will(returnValue(true));
		oneOf(database).containsLocalAuthor(txn, authorId);
		will(returnValue(false));
		// Contact already exists for this local identity
		oneOf(database).containsContact(txn, authorId, localAuthorId);
		will(returnValue(true));
		oneOf(database).abortTransaction(txn);
	}});

	DatabaseComponent db = createDatabaseComponent(database, eventBus,
			shutdown);

	Transaction transaction = db.startTransaction(false);
	try {
		db.addContact(transaction, author, localAuthorId, true, true);
		fail();
	} catch (ContactExistsException expected) {
		// Expected
	} finally {
		db.endTransaction(transaction);
	}

	context.assertIsSatisfied();
}
 
開發者ID:rafjordao,項目名稱:Nird2,代碼行數:37,代碼來源:DatabaseComponentImplTest.java

示例7: testReceiveMessageWithoutVisibleGroup

import org.jmock.Mockery; //導入方法依賴的package包/類
@Test
public void testReceiveMessageWithoutVisibleGroup() throws Exception {
	Mockery context = new Mockery();
	@SuppressWarnings("unchecked")
	final Database<Object> database = context.mock(Database.class);
	final ShutdownManager shutdown = context.mock(ShutdownManager.class);
	final EventBus eventBus = context.mock(EventBus.class);
	context.checking(new Expectations() {{
		oneOf(database).startTransaction();
		will(returnValue(txn));
		oneOf(database).containsContact(txn, contactId);
		will(returnValue(true));
		oneOf(database).getGroupVisibility(txn, contactId, groupId);
		will(returnValue(INVISIBLE));
		oneOf(database).commitTransaction(txn);
	}});
	DatabaseComponent db = createDatabaseComponent(database, eventBus,
			shutdown);

	Transaction transaction = db.startTransaction(false);
	try {
		db.receiveMessage(transaction, contactId, message);
		db.commitTransaction(transaction);
	} finally {
		db.endTransaction(transaction);
	}

	context.assertIsSatisfied();
}
 
開發者ID:rafjordao,項目名稱:Nird2,代碼行數:30,代碼來源:DatabaseComponentImplTest.java

示例8: testNotChangingVisibilityDoesNotCallListeners

import org.jmock.Mockery; //導入方法依賴的package包/類
@Test
public void testNotChangingVisibilityDoesNotCallListeners()
		throws Exception {
	Mockery context = new Mockery();
	@SuppressWarnings("unchecked")
	final Database<Object> database = context.mock(Database.class);
	final ShutdownManager shutdown = context.mock(ShutdownManager.class);
	final EventBus eventBus = context.mock(EventBus.class);
	context.checking(new Expectations() {{
		oneOf(database).startTransaction();
		will(returnValue(txn));
		oneOf(database).containsContact(txn, contactId);
		will(returnValue(true));
		oneOf(database).containsGroup(txn, groupId);
		will(returnValue(true));
		oneOf(database).getGroupVisibility(txn, contactId, groupId);
		will(returnValue(VISIBLE)); // Already visible
		oneOf(database).commitTransaction(txn);
	}});
	DatabaseComponent db = createDatabaseComponent(database, eventBus,
			shutdown);

	Transaction transaction = db.startTransaction(false);
	try {
		db.setGroupVisibility(transaction, contactId, groupId, VISIBLE);
		db.commitTransaction(transaction);
	} finally {
		db.endTransaction(transaction);
	}

	context.assertIsSatisfied();
}
 
開發者ID:rafjordao,項目名稱:Nird2,代碼行數:33,代碼來源:DatabaseComponentImplTest.java

示例9: testCloseWithoutWritingWritesFinalFrame

import org.jmock.Mockery; //導入方法依賴的package包/類
@Test
public void testCloseWithoutWritingWritesFinalFrame() throws Exception {
	Mockery context = new Mockery();
	final StreamEncrypter encrypter = context.mock(StreamEncrypter.class);
	context.checking(new Expectations() {{
		// Write an empty final frame
		oneOf(encrypter).writeFrame(with(any(byte[].class)), with(0),
				with(0), with(true));
		// Flush the stream
		oneOf(encrypter).flush();
	}});
	StreamWriterImpl w = new StreamWriterImpl(encrypter);
	w.close();
	context.assertIsSatisfied();
}
 
開發者ID:rafjordao,項目名稱:Nird2,代碼行數:16,代碼來源:StreamWriterImplTest.java

示例10: testReceiveAck

import org.jmock.Mockery; //導入方法依賴的package包/類
@Test
public void testReceiveAck() throws Exception {
	Mockery context = new Mockery();
	@SuppressWarnings("unchecked")
	final Database<Object> database = context.mock(Database.class);
	final ShutdownManager shutdown = context.mock(ShutdownManager.class);
	final EventBus eventBus = context.mock(EventBus.class);
	context.checking(new Expectations() {{
		oneOf(database).startTransaction();
		will(returnValue(txn));
		oneOf(database).containsContact(txn, contactId);
		will(returnValue(true));
		oneOf(database).containsVisibleMessage(txn, contactId, messageId);
		will(returnValue(true));
		oneOf(database).raiseSeenFlag(txn, contactId, messageId);
		oneOf(database).commitTransaction(txn);
		oneOf(eventBus).broadcast(with(any(MessagesAckedEvent.class)));
	}});
	DatabaseComponent db = createDatabaseComponent(database, eventBus,
			shutdown);

	Transaction transaction = db.startTransaction(false);
	try {
		Ack a = new Ack(Collections.singletonList(messageId));
		db.receiveAck(transaction, contactId, a);
		db.commitTransaction(transaction);
	} finally {
		db.endTransaction(transaction);
	}

	context.assertIsSatisfied();
}
 
開發者ID:rafjordao,項目名稱:Nird2,代碼行數:33,代碼來源:DatabaseComponentImplTest.java

示例11: testWritingToWriter

import org.jmock.Mockery; //導入方法依賴的package包/類
@Test
public void testWritingToWriter() throws Exception {
	final File drive1 = new File(testDir, "1");
	final File drive2 = new File(testDir, "2");
	final List<File> drives = new ArrayList<>();
	drives.add(drive1);
	drives.add(drive2);
	// Create drive1 as a directory
	assertTrue(drive1.mkdir());

	Mockery context = new Mockery() {{
		setThreadingPolicy(new Synchroniser());
	}};
	final Executor executor = context.mock(Executor.class);
	final SimplexPluginCallback callback =
			context.mock(SimplexPluginCallback.class);
	final RemovableDriveFinder finder =
			context.mock(RemovableDriveFinder.class);
	final RemovableDriveMonitor monitor =
			context.mock(RemovableDriveMonitor.class);

	context.checking(new Expectations() {{
		oneOf(monitor).start(with(any(Callback.class)));
		oneOf(finder).findRemovableDrives();
		will(returnValue(drives));
		oneOf(callback).showChoice(with(any(String[].class)),
				with(any(String[].class)));
		will(returnValue(0)); // The user chose drive1
		oneOf(callback).showMessage(with(any(String[].class)));
	}});

	RemovableDrivePlugin plugin = new RemovableDrivePlugin(executor,
			callback, finder, monitor, 0);
	plugin.start();

	TransportConnectionWriter writer = plugin.createWriter(contactId);
	assertNotNull(writer);
	// The output file should exist and should be empty
	File[] files = drive1.listFiles();
	assertNotNull(files);
	assertEquals(1, files.length);
	assertEquals(0, files[0].length());
	// Writing to the output stream should increase the size of the file
	OutputStream out = writer.getOutputStream();
	out.write(new byte[1234]);
	out.flush();
	out.close();
	// Disposing of the writer should not delete the file
	writer.dispose(false);
	assertTrue(files[0].exists());
	assertEquals(1234, files[0].length());

	context.assertIsSatisfied();
}
 
開發者ID:rafjordao,項目名稱:Nird2,代碼行數:55,代碼來源:RemovableDrivePluginTest.java

示例12: testGenerateRequestedBatch

import org.jmock.Mockery; //導入方法依賴的package包/類
@Test
public void testGenerateRequestedBatch() throws Exception {
	final byte[] raw1 = new byte[size];
	final Collection<MessageId> ids = Arrays.asList(messageId, messageId1);
	final Collection<byte[]> messages = Arrays.asList(raw, raw1);
	Mockery context = new Mockery();
	@SuppressWarnings("unchecked")
	final Database<Object> database = context.mock(Database.class);
	final ShutdownManager shutdown = context.mock(ShutdownManager.class);
	final EventBus eventBus = context.mock(EventBus.class);
	context.checking(new Expectations() {{
		oneOf(database).startTransaction();
		will(returnValue(txn));
		oneOf(database).containsContact(txn, contactId);
		will(returnValue(true));
		oneOf(database).getRequestedMessagesToSend(txn, contactId,
				size * 2);
		will(returnValue(ids));
		oneOf(database).getRawMessage(txn, messageId);
		will(returnValue(raw));
		oneOf(database).updateExpiryTime(txn, contactId, messageId,
				maxLatency);
		oneOf(database).getRawMessage(txn, messageId1);
		will(returnValue(raw1));
		oneOf(database).updateExpiryTime(txn, contactId, messageId1,
				maxLatency);
		oneOf(database).lowerRequestedFlag(txn, contactId, ids);
		oneOf(database).commitTransaction(txn);
		oneOf(eventBus).broadcast(with(any(MessagesSentEvent.class)));
	}});
	DatabaseComponent db = createDatabaseComponent(database, eventBus,
			shutdown);

	Transaction transaction = db.startTransaction(false);
	try {
		assertEquals(messages, db.generateRequestedBatch(transaction,
				contactId, size * 2, maxLatency));
		db.commitTransaction(transaction);
	} finally {
		db.endTransaction(transaction);
	}

	context.assertIsSatisfied();
}
 
開發者ID:rafjordao,項目名稱:Nird2,代碼行數:45,代碼來源:DatabaseComponentImplTest.java

示例13: testRescheduleDoesNotReplaceEarlierTask

import org.jmock.Mockery; //導入方法依賴的package包/類
@Test
public void testRescheduleDoesNotReplaceEarlierTask() throws Exception {
	Mockery context = new Mockery();
	context.setImposteriser(ClassImposteriser.INSTANCE);
	final Executor ioExecutor = new ImmediateExecutor();
	final ScheduledExecutorService scheduler =
			context.mock(ScheduledExecutorService.class);
	final ConnectionManager connectionManager =
			context.mock(ConnectionManager.class);
	final ConnectionRegistry connectionRegistry =
			context.mock(ConnectionRegistry.class);
	final PluginManager pluginManager = context.mock(PluginManager.class);
	final SecureRandom random = context.mock(SecureRandom.class);
	final Clock clock = context.mock(Clock.class);

	final DuplexPlugin plugin = context.mock(DuplexPlugin.class);
	final TransportId transportId = new TransportId("id");

	context.checking(new Expectations() {{
		allowing(plugin).getId();
		will(returnValue(transportId));
		// First event
		// Get the plugin
		oneOf(pluginManager).getPlugin(transportId);
		will(returnValue(plugin));
		// The plugin supports polling
		oneOf(plugin).shouldPoll();
		will(returnValue(true));
		// Schedule the next poll
		oneOf(plugin).getPollingInterval();
		will(returnValue(pollingInterval));
		oneOf(clock).currentTimeMillis();
		will(returnValue(now));
		oneOf(scheduler).schedule(with(any(Runnable.class)),
				with((long) pollingInterval), with(MILLISECONDS));
		// Second event
		// Get the plugin
		oneOf(pluginManager).getPlugin(transportId);
		will(returnValue(plugin));
		// The plugin supports polling
		oneOf(plugin).shouldPoll();
		will(returnValue(true));
		// Don't replace the previously scheduled task, due earlier
		oneOf(plugin).getPollingInterval();
		will(returnValue(pollingInterval));
		oneOf(clock).currentTimeMillis();
		will(returnValue(now + 1));
	}});

	Poller p = new Poller(ioExecutor, scheduler, connectionManager,
			connectionRegistry, pluginManager, random, clock);

	p.eventOccurred(new ConnectionOpenedEvent(contactId, transportId,
			false));
	p.eventOccurred(new ConnectionOpenedEvent(contactId, transportId,
			false));

	context.assertIsSatisfied();
}
 
開發者ID:rafjordao,項目名稱:Nird2,代碼行數:60,代碼來源:PollerTest.java

示例14: testWriterIsNotNullIfOutputDirIsADir

import org.jmock.Mockery; //導入方法依賴的package包/類
@Test
public void testWriterIsNotNullIfOutputDirIsADir() throws Exception {
	final File drive1 = new File(testDir, "1");
	final File drive2 = new File(testDir, "2");
	final List<File> drives = new ArrayList<>();
	drives.add(drive1);
	drives.add(drive2);
	// Create drive1 as a directory
	assertTrue(drive1.mkdir());

	Mockery context = new Mockery() {{
		setThreadingPolicy(new Synchroniser());
	}};
	final Executor executor = context.mock(Executor.class);
	final SimplexPluginCallback callback =
			context.mock(SimplexPluginCallback.class);
	final RemovableDriveFinder finder =
			context.mock(RemovableDriveFinder.class);
	final RemovableDriveMonitor monitor =
			context.mock(RemovableDriveMonitor.class);

	context.checking(new Expectations() {{
		oneOf(monitor).start(with(any(Callback.class)));
		oneOf(finder).findRemovableDrives();
		will(returnValue(drives));
		oneOf(callback).showChoice(with(any(String[].class)),
				with(any(String[].class)));
		will(returnValue(0)); // The user chose drive1
	}});

	RemovableDrivePlugin plugin = new RemovableDrivePlugin(executor,
			callback, finder, monitor, 0);
	plugin.start();

	assertNotNull(plugin.createWriter(contactId));
	// The output file should exist and should be empty
	File[] files = drive1.listFiles();
	assertNotNull(files);
	assertEquals(1, files.length);
	assertEquals(0, files[0].length());

	context.assertIsSatisfied();
}
 
開發者ID:rafjordao,項目名稱:Nird2,代碼行數:44,代碼來源:RemovableDrivePluginTest.java

示例15: testIncomingMessageHookDelegatesInOrderMessage

import org.jmock.Mockery; //導入方法依賴的package包/類
@Test
public void testIncomingMessageHookDelegatesInOrderMessage()
		throws Exception {
	Mockery context = new Mockery();
	final DatabaseComponent db = context.mock(DatabaseComponent.class);
	final ClientHelper clientHelper = context.mock(ClientHelper.class);
	final QueueMessageFactory queueMessageFactory =
			context.mock(QueueMessageFactory.class);
	final ValidationManager validationManager =
			context.mock(ValidationManager.class);
	final AtomicReference<IncomingMessageHook> captured =
			new AtomicReference<IncomingMessageHook>();
	final IncomingQueueMessageHook incomingQueueMessageHook =
			context.mock(IncomingQueueMessageHook.class);

	final Transaction txn = new Transaction(null, false);
	final Metadata groupMetadata = new Metadata();
	final byte[] queueState = new byte[123];
	groupMetadata.put(QUEUE_STATE_KEY, queueState);
	// The message has queue position 0
	final MessageId messageId = new MessageId(TestUtils.getRandomId());
	final byte[] raw = new byte[QUEUE_MESSAGE_HEADER_LENGTH];
	final Message message = new Message(messageId, groupId, timestamp, raw);
	final Metadata messageMetadata = new Metadata();

	context.checking(new Expectations() {{
		oneOf(validationManager).registerIncomingMessageHook(with(clientId),
				with(any(IncomingMessageHook.class)));
		will(new CaptureArgumentAction<IncomingMessageHook>(captured,
				IncomingMessageHook.class, 1));
		oneOf(db).getGroupMetadata(txn, groupId);
		will(returnValue(groupMetadata));
		// Queue position 0 is expected
		oneOf(clientHelper).toDictionary(queueState, 0, queueState.length);
		will(new DecodeQueueStateAction(0L, 0L, new BdfList()));
		// Queue position 1 should be expected next
		oneOf(clientHelper).toByteArray(with(any(BdfDictionary.class)));
		will(new EncodeQueueStateAction(0L, 1L, new BdfList()));
		oneOf(db).mergeGroupMetadata(with(txn), with(groupId),
				with(any(Metadata.class)));
		// The message should be delegated
		oneOf(incomingQueueMessageHook).incomingMessage(with(txn),
				with(any(QueueMessage.class)), with(messageMetadata));
	}});

	MessageQueueManagerImpl mqm = new MessageQueueManagerImpl(db,
			clientHelper, queueMessageFactory, validationManager);

	// Capture the delegating incoming message hook
	mqm.registerIncomingMessageHook(clientId, incomingQueueMessageHook);
	IncomingMessageHook delegate = captured.get();
	assertNotNull(delegate);
	// Pass the message to the hook
	delegate.incomingMessage(txn, message, messageMetadata);

	context.assertIsSatisfied();
}
 
開發者ID:rafjordao,項目名稱:Nird2,代碼行數:58,代碼來源:MessageQueueManagerImplTest.java


注:本文中的org.jmock.Mockery.assertIsSatisfied方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。