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


Java Assert.assertSame方法代碼示例

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


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

示例1: testFindPricedOption

import org.junit.Assert; //導入方法依賴的package包/類
@Test
public void testFindPricedOption() {
    List<VOPricedOption> list = new ArrayList<VOPricedOption>();
    parameterDefinitionWithOption.getParameterOptions().get(3);

    for (VOParameterOption option : parameterDefinitionWithOption
            .getParameterOptions()) {
        VOPricedOption pricedOption = new VOPricedOption();
        pricedOption.setParameterOptionKey(option.getKey());
        list.add(pricedOption);
    }
    Assert.assertSame(list.get(3), VOFinder.findPricedOption(list,
            parameterDefinitionWithOption.getParameterOptions().get(3)));

    Assert.assertNull(VOFinder.findPricedOption(list,
            new VOParameterOption("", "", "")));
    Assert.assertNull(VOFinder.findPricedOption(null,
            parameterDefinitionWithOption.getParameterOptions().get(0)));
    Assert.assertNull(VOFinder.findPricedOption(list, null));
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:21,代碼來源:VOFinderTest.java

示例2: sendFailResponseHaveProduceProcessor

import org.junit.Assert; //導入方法依賴的package包/類
@Test
public void sendFailResponseHaveProduceProcessor() {
  Holder<Response> result = new Holder<>();
  restInvocation = new AbstractRestInvocationForTest() {
    @Override
    protected void doInvoke() throws Throwable {
    }

    @Override
    protected void sendResponseQuietly(Response response) {
      result.value = response;
    }
  };
  initRestInvocation();
  restInvocation.produceProcessor = ProduceProcessorManager.PLAIN_PROCESSOR;

  Throwable e = new InvocationException(Status.BAD_GATEWAY, "");
  restInvocation.sendFailResponse(e);
  Assert.assertSame(e, result.value.getResult());
  Assert.assertSame(ProduceProcessorManager.PLAIN_PROCESSOR, restInvocation.produceProcessor);
}
 
開發者ID:apache,項目名稱:incubator-servicecomb-java-chassis,代碼行數:22,代碼來源:TestAbstractRestInvocation.java

示例3: createEndpointNormal

import org.junit.Assert; //導入方法依賴的package包/類
@Test
public void createEndpointNormal(@Mocked Transport transport, @Mocked MicroserviceInstance instance) {
  String endpoint = "rest://ip:port";
  Object address = new Object();

  new Expectations() {
    {
      transportManager.findTransport(Const.RESTFUL);
      result = transport;
      transport.parseAddress(endpoint);
      result = address;
    }
  };

  Endpoint ep = (Endpoint) filter.createEndpoint(Const.RESTFUL, endpoint, instance);
  Assert.assertSame(transport, ep.getTransport());
  Assert.assertSame(address, ep.getAddress());
  Assert.assertSame(instance, ep.getMicroserviceInstance());
  Assert.assertEquals(endpoint, ep.getEndpoint());
}
 
開發者ID:apache,項目名稱:incubator-servicecomb-java-chassis,代碼行數:21,代碼來源:TestEndpointDiscoveryFilter.java

示例4: create

import org.junit.Assert; //導入方法依賴的package包/類
@Test
public void create(@Mocked Microservice microservice) {
  String microserviceId = "id";
  new Expectations(RegistryUtils.class) {
    {
      RegistryUtils.getMicroservice(microserviceId);
      result = microservice;
      microservice.getVersion();
      result = "1.0.0";
    }
  };

  MicroserviceVersion microserviceVersion = new DefaultMicroserviceVersionFactory().create("", microserviceId);
  Assert.assertSame(microservice, microserviceVersion.getMicroservice());
  Assert.assertEquals("1.0.0", microserviceVersion.getVersion().getVersion());
}
 
開發者ID:apache,項目名稱:incubator-servicecomb-java-chassis,代碼行數:17,代碼來源:TestDefaultMicroserviceVersionFactory.java

示例5: test_list_not_in_null

import org.junit.Assert; //導入方法依賴的package包/類
public void test_list_not_in_null() throws Exception {
    JSONPath path = new JSONPath("[id not in (null)]");
    
    List<Entity> entities = new ArrayList<Entity>();
    entities.add(new Entity(1001, "ljw2083"));
    entities.add(new Entity(1002, "wenshao"));
    entities.add(new Entity(1003, "yakolee"));
    entities.add(new Entity(1004, null));
    
    List<Object> result = (List<Object>) path.eval(entities);
    Assert.assertEquals(4, result.size());
    Assert.assertSame(entities.get(0), result.get(0));
    Assert.assertSame(entities.get(1), result.get(1));
    Assert.assertSame(entities.get(2), result.get(2));
    Assert.assertSame(entities.get(3), result.get(3));
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:17,代碼來源:JSONPath_field_access_filter_in_int.java

示例6: test_list_like_right_match

import org.junit.Assert; //導入方法依賴的package包/類
public void test_list_like_right_match() throws Exception {
    JSONPath path = new JSONPath("$[?(@.name like '%2083')]");

    List<Entity> entities = new ArrayList<Entity>();
    entities.add(new Entity(1001, "ljw2083"));
    entities.add(new Entity(1002, "wenshao"));
    entities.add(new Entity(1003, "yakolee"));
    entities.add(new Entity(null, null));

    List<Object> result = (List<Object>) path.eval(entities);
    Assert.assertEquals(1, result.size());
    Assert.assertSame(entities.get(0), result.get(0));
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:14,代碼來源:JSONPath_field_access_filter_like.java

示例7: latch_await

import org.junit.Assert; //導入方法依賴的package包/類
void latch_await(){
    try {
        latch.await(10000, TimeUnit.MILLISECONDS);
    } catch (InterruptedException e) {
        Assert.fail("unexpected interrupt");
    }
    Assert.assertSame(0L, latch.getCount());
}
 
開發者ID:didichuxing2,項目名稱:https-github.com-apache-zookeeper,代碼行數:9,代碼來源:AsyncOps.java

示例8: updateUser

import org.junit.Assert; //導入方法依賴的package包/類
@Test
public void updateUser() {
	user.setFirstName("L");

	repository.update(user);

	Mockito.verify(repository.ldapCacheDao).update(user);
	Assert.assertSame("L", users.get("u").getFirstName());
}
 
開發者ID:ligoj,項目名稱:plugin-id-ldap,代碼行數:10,代碼來源:LdapCacheRepositoryTest.java

示例9: test_between

import org.junit.Assert; //導入方法依賴的package包/類
public void test_between() throws Exception {
    List list = new ArrayList();
    list.add(new Entity(101, "kiki"));
    list.add(new Entity(102, "ljw2083"));
    list.add(new Entity(103, "ljw2083"));
    List<Object> result = (List<Object>) JSONPath.eval(list, "$[id between 101 and 101]");
    Assert.assertEquals(1, result.size());
    Assert.assertSame(list.get(0), result.get(0));
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:10,代碼來源:JSONPath_between_int.java

示例10: saveAndGetBlockByHash

import org.junit.Assert; //導入方法依賴的package包/類
@Test
public void saveAndGetBlockByHash() {
    BlockStore store = new BlockStore();
    Block block = BlockGenerator.getInstance().getGenesisBlock();

    store.saveBlock(block);

    Assert.assertSame(block, store.getBlockByHash(block.getHash()));
    Assert.assertEquals(0, store.minimalHeight());
    Assert.assertEquals(0, store.maximumHeight());
}
 
開發者ID:rsksmart,項目名稱:rskj,代碼行數:12,代碼來源:BlockStoreTest.java

示例11: testErrors

import org.junit.Assert; //導入方法依賴的package包/類
@Test
public void testErrors() {
	JsonApiResponse response = new JsonApiResponse();

	ErrorData error = Mockito.mock(ErrorData.class);
	response.setErrors(Arrays.asList(error));

	Document document = mapper.toDocument(response, createAdapter(Task.class));
	List<ErrorData> errors = document.getErrors();
	Assert.assertEquals(1, errors.size());
	Assert.assertSame(error, errors.get(0));
}
 
開發者ID:crnk-project,項目名稱:crnk-framework,代碼行數:13,代碼來源:DocumentMapperTest.java

示例12: setInstances

import org.junit.Assert; //導入方法依賴的package包/類
@Test
public void setInstances() {
  MicroserviceVersion v1 = MicroserviceVersionTestUtils.createMicroserviceVersion("1", "0.0.1");
  microserviceVersionRule.addMicroserviceVersion(v1);

  MicroserviceVersion v2 = MicroserviceVersionTestUtils.createMicroserviceVersion("2", "2.0.0");
  microserviceVersionRule.addMicroserviceVersion(v2);

  MicroserviceInstance instance1 = new MicroserviceInstance();
  instance1.setServiceId("1");
  instance1.setInstanceId("i1");

  MicroserviceInstance instance2 = new MicroserviceInstance();
  instance2.setServiceId("2");
  instance2.setInstanceId("i2");

  MicroserviceInstance instance3 = new MicroserviceInstance();
  instance3.setServiceId("3");
  instance3.setInstanceId("i3");

  InstanceCache orgCache = microserviceVersionRule.getInstanceCache();
  microserviceVersionRule.setInstances(Arrays.asList(instance1, instance2, instance3));

  Assert.assertThat(microserviceVersionRule.getInstances().values(), Matchers.contains(instance2));
  Assert.assertNotSame(orgCache, microserviceVersionRule.getInstanceCache());
  Assert.assertSame(microserviceVersionRule.getInstances(),
      microserviceVersionRule.getInstanceCache().getInstanceMap());
  Assert.assertSame(microserviceVersionRule.getInstances(),
      microserviceVersionRule.getVersionedCache().data());
}
 
開發者ID:apache,項目名稱:incubator-servicecomb-java-chassis,代碼行數:31,代碼來源:TestMicroserviceVersionRule.java

示例13: setQuerySpecDeserializer

import org.junit.Assert; //導入方法依賴的package包/類
@Test
public void setQuerySpecDeserializer() {
	CrnkBoot boot = new CrnkBoot();
	boot.setServiceDiscoveryFactory(serviceDiscoveryFactory);
	boot.setDefaultServiceUrlProvider(Mockito.mock(ServiceUrlProvider.class));

	QuerySpecDeserializer deserializer = Mockito.mock(QuerySpecDeserializer.class);
	boot.setQuerySpecDeserializer(deserializer);
	Assert.assertSame(deserializer, boot.getQuerySpecDeserializer());
	boot.boot();

	HttpRequestProcessorImpl requestDispatcher = boot.getRequestDispatcher();
	QueryAdapterBuilder queryAdapterBuilder = requestDispatcher.getQueryAdapterBuilder();
	Assert.assertTrue(queryAdapterBuilder instanceof QuerySpecAdapterBuilder);
}
 
開發者ID:crnk-project,項目名稱:crnk-framework,代碼行數:16,代碼來源:CrnkBootTest.java

示例14: discoveryInited

import org.junit.Assert; //導入方法依賴的package包/類
@Test
public void discoveryInited() {
  doDiscovery();

  Assert.assertEquals(1, childrenInitedCallCount);
  Assert.assertEquals(0, initCallCount);
  Assert.assertSame(child, result);
}
 
開發者ID:apache,項目名稱:incubator-servicecomb-java-chassis,代碼行數:9,代碼來源:TestAbstractDiscoveryFilter.java

示例15: testCompleteThenPoll

import org.junit.Assert; //導入方法依賴的package包/類
@Test
public void testCompleteThenPoll() {
	GenericParameterHelper enqueuedValue = new GenericParameterHelper(1);
	queue.add(enqueuedValue);
	queue.complete();
	Assert.assertFalse(queue.getFuture().isDone());

	GenericParameterHelper dequeuedValue = queue.poll();
	Assert.assertNotNull(dequeuedValue);
	Assert.assertSame(enqueuedValue, dequeuedValue);
	Assert.assertTrue(queue.getFuture().isDone());
}
 
開發者ID:tunnelvisionlabs,項目名稱:java-threading,代碼行數:13,代碼來源:AsyncQueueTest.java


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