本文整理汇总了Java中junit.framework.Assert.assertSame方法的典型用法代码示例。如果您正苦于以下问题:Java Assert.assertSame方法的具体用法?Java Assert.assertSame怎么用?Java Assert.assertSame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类junit.framework.Assert
的用法示例。
在下文中一共展示了Assert.assertSame方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testBasic
import junit.framework.Assert; //导入方法依赖的package包/类
@Test
public void testBasic() throws Exception {
Assert.assertFalse(mCloseableStaticBitmap.isClosed());
Assert.assertSame(mBitmap, mCloseableStaticBitmap.getUnderlyingBitmap());
// close it now
mCloseableStaticBitmap.close();
Assert.assertTrue(mCloseableStaticBitmap.isClosed());
Assert.assertNull(mCloseableStaticBitmap.getUnderlyingBitmap());
verify(mResourceReleaser).release(mBitmap);
// close it again
mCloseableStaticBitmap.close();
Assert.assertTrue(mCloseableStaticBitmap.isClosed());
Assert.assertNull(mCloseableStaticBitmap.getUnderlyingBitmap());
}
示例2: testSessionEstablishment
import junit.framework.Assert; //导入方法依赖的package包/类
/**
* Tests a situation when client firstly connects to a read-only server and
* then connects to a majority server. Transition should be transparent for
* the user.
*/
@Test(timeout = 90000)
public void testSessionEstablishment() throws Exception {
qu.shutdown(2);
CountdownWatcher watcher = new CountdownWatcher();
ZooKeeper zk = new ZooKeeper(qu.getConnString(), CONNECTION_TIMEOUT,
watcher, true);
watcher.waitForConnected(CONNECTION_TIMEOUT);
Assert.assertSame("should be in r/o mode", States.CONNECTEDREADONLY, zk
.getState());
long fakeId = zk.getSessionId();
watcher.reset();
qu.start(2);
Assert.assertTrue("waiting for server up", ClientBase.waitForServerUp(
"127.0.0.1:" + qu.getPeer(2).clientPort, CONNECTION_TIMEOUT));
watcher.waitForConnected(CONNECTION_TIMEOUT);
zk.create("/test", "test".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE,
CreateMode.PERSISTENT);
Assert.assertFalse("fake session and real session have same id", zk
.getSessionId() == fakeId);
zk.close();
}
示例3: testExceptionThrown_NoRetry
import junit.framework.Assert; //导入方法依赖的package包/类
@Test
public void testExceptionThrown_NoRetry() {
RuntimeException exception = new RuntimeException("BOOM");
when(ddbMock.batchWriteItem(any(BatchWriteItemRequest.class))).thenThrow(exception);
// put a random item
Item item = new Item(UUID.randomUUID().toString());
List<FailedBatch> failedBatches = mapper.batchSave(item);
Assert.assertEquals(1, failedBatches.size());
FailedBatch failedBatch = failedBatches.get(0);
Assert.assertEquals(
"Failed batch should contain all the input items for batchWrite",
Collections.singletonMap(TABLE_NAME, Arrays.asList(item.toPutSaveRequest())),
failedBatch.getUnprocessedItems());
Assert.assertSame(
"The exception should be the same as one thrown by BatchWriteItem",
exception,
failedBatch.getException());
}
示例4: testReusableChannel
import junit.framework.Assert; //导入方法依赖的package包/类
@Test
public void testReusableChannel() throws Exception {
String agentName = "agent1";
Map<String, String> properties = getPropertiesForChannel(agentName,
RecyclableChannel.class.getName());
MemoryConfigurationProvider provider =
new MemoryConfigurationProvider(agentName, properties);
MaterializedConfiguration config1 = provider.getConfiguration();
Channel channel1 = config1.getChannels().values().iterator().next();
Assert.assertTrue(channel1 instanceof RecyclableChannel);
MaterializedConfiguration config2 = provider.getConfiguration();
Channel channel2 = config2.getChannels().values().iterator().next();
Assert.assertTrue(channel2 instanceof RecyclableChannel);
Assert.assertSame(channel1, channel2);
}
示例5: testUnspecifiedChannel
import junit.framework.Assert; //导入方法依赖的package包/类
@Test
public void testUnspecifiedChannel() throws Exception {
String agentName = "agent1";
Map<String, String> properties = getPropertiesForChannel(agentName,
UnspecifiedChannel.class.getName());
MemoryConfigurationProvider provider =
new MemoryConfigurationProvider(agentName, properties);
MaterializedConfiguration config1 = provider.getConfiguration();
Channel channel1 = config1.getChannels().values().iterator().next();
Assert.assertTrue(channel1 instanceof UnspecifiedChannel);
MaterializedConfiguration config2 = provider.getConfiguration();
Channel channel2 = config2.getChannels().values().iterator().next();
Assert.assertTrue(channel2 instanceof UnspecifiedChannel);
Assert.assertSame(channel1, channel2);
}
示例6: testInvokeNoExceptoin
import junit.framework.Assert; //导入方法依赖的package包/类
@Test()
public void testInvokeNoExceptoin() {
resetInvokerToNoException();
ForkingClusterInvoker<ForkingClusterInvokerTest> invoker = new ForkingClusterInvoker<ForkingClusterInvokerTest>(
dic);
Result ret = invoker.invoke(invocation);
Assert.assertSame(result, ret);
}
示例7: testInvokeExceptoin
import junit.framework.Assert; //导入方法依赖的package包/类
@Test(expected = RpcException.class)
public void testInvokeExceptoin() {
resetInvoker1ToException();
FailfastClusterInvoker<FailfastClusterInvokerTest> invoker = new FailfastClusterInvoker<FailfastClusterInvokerTest>(dic);
invoker.invoke(invocation);
Assert.assertSame(invoker1, RpcContext.getContext().getInvoker());
}
示例8: testInvokeNoExceptoin
import junit.framework.Assert; //导入方法依赖的package包/类
@Test()
public void testInvokeNoExceptoin() {
resetInvoker1ToNoException();
FailfastClusterInvoker<FailfastClusterInvokerTest> invoker = new FailfastClusterInvoker<FailfastClusterInvokerTest>(dic);
Result ret = invoker.invoke(invocation);
Assert.assertSame(result, ret);
}
示例9: testInvokeNoExceptoin
import junit.framework.Assert; //导入方法依赖的package包/类
@Test()
public void testInvokeNoExceptoin() {
resetInvokerToNoException();
ForkingClusterInvoker<ForkingClusterInvokerTest> invoker = new ForkingClusterInvoker<ForkingClusterInvokerTest>(
dic);
Result ret = invoker.invoke(invocation);
Assert.assertSame(result, ret);
}
示例10: testInvokeNoExceptoin
import junit.framework.Assert; //导入方法依赖的package包/类
@Test()
public void testInvokeNoExceptoin() {
resetInvokerToNoException();
FailsafeClusterInvoker<DemoService> invoker = new FailsafeClusterInvoker<DemoService>(dic);
Result ret = invoker.invoke(invocation);
Assert.assertSame(result, ret);
}
示例11: testInvokeNoExceptoin
import junit.framework.Assert; //导入方法依赖的package包/类
@Test()
public void testInvokeNoExceptoin() {
resetInvokerToNoException();
FailbackClusterInvoker<FailbackClusterInvokerTest> invoker = new FailbackClusterInvoker<FailbackClusterInvokerTest>(
dic);
Result ret = invoker.invoke(invocation);
Assert.assertSame(result, ret);
}
示例12: testInvokeNoExceptoin
import junit.framework.Assert; //导入方法依赖的package包/类
@Test()
public void testInvokeNoExceptoin() {
resetInvokerToNoException();
FailsafeClusterInvoker<DemoService> invoker = new FailsafeClusterInvoker<DemoService>(dic);
Result ret = invoker.invoke(invocation);
Assert.assertSame(result, ret);
}
示例13: assertException
import junit.framework.Assert; //导入方法依赖的package包/类
/**
* Verify that the listener completes in a reasonable amount of time, and
* Asserts that the future throws an {@code ExecutableException} and that the
* cause of the {@code ExecutableException} is {@code expectedCause}.
*/
public void assertException(Throwable expectedCause) throws Exception {
// Verify that the listener executed in a reasonable amount of time.
Assert.assertTrue(countDownLatch.await(1L, TimeUnit.SECONDS));
try {
future.get();
Assert.fail("This call was supposed to throw an ExecutionException");
} catch (ExecutionException expected) {
Assert.assertSame(expectedCause, expected.getCause());
}
}
示例14: testHostGraphToStartLocation
import junit.framework.Assert; //导入方法依赖的package包/类
/**
* Tests hostGraphToStartLocation.
*/
public void testHostGraphToStartLocation() {
Location l = this.sts.hostGraphToStartLocation(this.g2);
Assert.assertSame(this.sts.getCurrentLocation(), l);
Assert.assertSame(this.sts.getStartLocation(), l);
LocationVariable v = this.sts.getLocationVariable(this.e2[1]);
Assert.assertNotNull(v);
}
示例15: testInvokeNoExceptoin
import junit.framework.Assert; //导入方法依赖的package包/类
@Test()
public void testInvokeNoExceptoin() {
resetInvokerToNoException();
FailbackClusterInvoker<FailbackClusterInvokerTest> invoker = new FailbackClusterInvoker<FailbackClusterInvokerTest>(
dic);
Result ret = invoker.invoke(invocation);
Assert.assertSame(result, ret);
}