当前位置: 首页>>代码示例>>Java>>正文


Java Assert.assertSame方法代码示例

本文整理汇总了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());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:CloseableBitmapTest.java

示例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();
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:30,代码来源:ReadOnlyModeTest.java

示例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());
}
 
开发者ID:aws,项目名称:aws-sdk-java-v2,代码行数:24,代码来源:BatchWriteRetryStrategyTest.java

示例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);
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:19,代码来源:TestAbstractConfigurationProvider.java

示例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);
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:19,代码来源:TestAbstractConfigurationProvider.java

示例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);
}
 
开发者ID:l1325169021,项目名称:github-test,代码行数:11,代码来源:ForkingClusterInvokerTest.java

示例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());
}
 
开发者ID:flychao88,项目名称:dubbocloud,代码行数:8,代码来源:FailfastClusterInvokerTest.java

示例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);
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:10,代码来源:FailfastClusterInvokerTest.java

示例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);
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:11,代码来源:ForkingClusterInvokerTest.java

示例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);
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:10,代码来源:FailSafeClusterInvokerTest.java

示例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);
}
 
开发者ID:zhuxiaolei,项目名称:dubbo2,代码行数:11,代码来源:FailbackClusterInvokerTest.java

示例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);
}
 
开发者ID:l1325169021,项目名称:github-test,代码行数:10,代码来源:FailSafeClusterInvokerTest.java

示例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());
  }
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:17,代码来源:MockFutureListener.java

示例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);
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:12,代码来源:STSTest.java

示例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);
}
 
开发者ID:l1325169021,项目名称:github-test,代码行数:11,代码来源:FailbackClusterInvokerTest.java


注:本文中的junit.framework.Assert.assertSame方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。