當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。