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


Java IsNull類代碼示例

本文整理匯總了Java中org.hamcrest.core.IsNull的典型用法代碼示例。如果您正苦於以下問題:Java IsNull類的具體用法?Java IsNull怎麽用?Java IsNull使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: refresh

import org.hamcrest.core.IsNull; //導入依賴的package包/類
@Test
public void refresh() throws Exception {
    final Reddit reddit = new Reddit();
    PublishSubject<Reddit> subject = PublishSubject.create();
    Mockito.doReturn(subject.asObservable().toList())
            .when(mRepository)
            .getReddits(Mockito.anyString());
    mViewModel.refresh();
    Mockito.verify(mRepository).getReddits("test");
    Assert.assertThat(mViewModel.errorText.get(), IsNull.nullValue());
    Assert.assertThat(mViewModel.isLoading.get(), Is.is(true));
    subject.onNext(reddit);
    subject.onCompleted();
    Assert.assertThat(mViewModel.isLoading.get(), Is.is(false));
    Assert.assertThat(mViewModel.reddits, IsCollectionContaining.hasItems(reddit));
}
 
開發者ID:DanielSerdyukov,項目名稱:droidcon2016,代碼行數:17,代碼來源:RedditListViewModelTest.java

示例2: testCustomCharFilterInRequest

import org.hamcrest.core.IsNull; //導入依賴的package包/類
public void testCustomCharFilterInRequest() throws Exception {
    Map<String, Object> charFilterSettings = new HashMap<>();
    charFilterSettings.put("type", "mapping");
    charFilterSettings.put("mappings", new String[]{"ph => f", "qu => q"});
    AnalyzeResponse analyzeResponse = client().admin().indices()
        .prepareAnalyze()
        .setText("jeff quit phish")
        .setTokenizer("keyword")
        .addCharFilter(charFilterSettings)
        .setExplain(true)
        .get();

    assertThat(analyzeResponse.detail().analyzer(), IsNull.nullValue());
    //charfilters
    assertThat(analyzeResponse.detail().charfilters().length, equalTo(1));
    assertThat(analyzeResponse.detail().charfilters()[0].getName(), equalTo("_anonymous_charfilter_[0]"));
    assertThat(analyzeResponse.detail().charfilters()[0].getTexts().length, equalTo(1));
    assertThat(analyzeResponse.detail().charfilters()[0].getTexts()[0], equalTo("jeff qit fish"));
    //tokenizer
    assertThat(analyzeResponse.detail().tokenizer().getName(), equalTo("keyword"));
    assertThat(analyzeResponse.detail().tokenizer().getTokens().length, equalTo(1));
    assertThat(analyzeResponse.detail().tokenizer().getTokens()[0].getTerm(), equalTo("jeff qit fish"));
    assertThat(analyzeResponse.detail().tokenizer().getTokens()[0].getStartOffset(), equalTo(0));
    assertThat(analyzeResponse.detail().tokenizer().getTokens()[0].getEndOffset(), equalTo(15));
    assertThat(analyzeResponse.detail().tokenizer().getTokens()[0].getPositionLength(), equalTo(1));
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:27,代碼來源:AnalyzeActionIT.java

示例3: refreshError

import org.hamcrest.core.IsNull; //導入依賴的package包/類
@Test
public void refreshError() throws Exception {
    PublishSubject<Reddit> subject = PublishSubject.create();
    Mockito.doReturn(subject.asObservable().toList())
            .when(mRepository)
            .getReddits(Mockito.anyString());
    mViewModel.refresh();
    Mockito.verify(mRepository).getReddits("test");
    Assert.assertThat(mViewModel.errorText.get(), IsNull.nullValue());
    Assert.assertThat(mViewModel.isLoading.get(), Is.is(true));
    subject.onError(new Exception("error text"));
    Assert.assertThat(mViewModel.isLoading.get(), Is.is(false));
    Assert.assertThat(mViewModel.errorText.get(), IsEqual.equalTo("error text"));
}
 
開發者ID:DanielSerdyukov,項目名稱:droidcon2016,代碼行數:15,代碼來源:RedditListViewModelTest.java

示例4: testRenameCluster

import org.hamcrest.core.IsNull; //導入依賴的package包/類
@Test
public void testRenameCluster() {
     Tree<ClusterVO, ItemAssocVO<Integer,Integer>> clusters = clusterService.getClustersForTenant(1);
     ClusterVO root = clusters.getRoot();
     printCluster(clusters, root);
     assertThat(clusters.getHeight(), is(2));
     assertThat(clusters.getChildCount(root), is(2));
     assertThat(clusters.getVertexCount(), is(5));
    assertThat(clusterService.loadCluster(1,"CLUSTER3"), IsNull.nullValue());
     try {
        clusterService.renameCluster(1, "CLUSTER1", "CLUSTER3");
     } catch (ClusterException ce) {
         logger.info(ce);
     }
     printCluster(clusters, root);
     assertThat(clusters.getHeight(), is(2));
     assertThat(clusters.getChildCount(root), is(2));
     assertThat(clusters.getVertexCount(), is(5));
     assertThat(clusterService.loadCluster(1,"CLUSTER3"), IsNull.notNullValue());
}
 
開發者ID:major2015,項目名稱:easyrec_major,代碼行數:21,代碼來源:ClusterServiceTest.java

示例5: shouldSupportImgRefLink

import org.hamcrest.core.IsNull; //導入依賴的package包/類
@Test
public void shouldSupportImgRefLink() throws IOException {
    final InputStream stream = getClass().getClassLoader().getResourceAsStream("withImgRefLink.md");
    assertThat( stream, IsNull.notNullValue());
    final InputStream inputStream = Site.processMarkdown(stream, "Test IMG");
    assertThat( inputStream, IsNull.notNullValue());
    final String converted = IOUtils.toString(inputStream);

    assertThat(converted, containsString("!http://www.lewe.com/wp-content/uploads/2016/03/conf-icon-64.png|alt=\"conf-icon\"|title=\"My conf-icon\"!"));
    assertThat(converted, containsString("!conf-icon-64.png|alt=\"conf-icon\"|title=\"My conf-icon\"!"));
    assertThat(converted, containsString("!conf-icon-64.png|alt=\"conf-icon\"!"));
    assertThat(converted, containsString("!http://www.lewe.com/wp-content/uploads/2016/03/conf-icon-64.png|alt=\"conf-icon-y\"|title=\"My conf-icon\"!"));
    assertThat(converted, containsString("!http://www.lewe.com/wp-content/uploads/2016/03/conf-icon-64.png|alt=\"conf-icon-y1\"!"));
    assertThat(converted, containsString("!conf-icon-64.png|alt=\"conf-icon-y2\"!"));
    assertThat(converted, containsString("!conf-icon-64.png|alt=\"conf-icon-none\"!"));
}
 
開發者ID:bsorrentino,項目名稱:maven-confluence-plugin,代碼行數:17,代碼來源:SiteTest.java

示例6: shouldSupportSimpleNode

import org.hamcrest.core.IsNull; //導入依賴的package包/類
@Test
public void shouldSupportSimpleNode() throws IOException {
    final InputStream stream = getClass().getClassLoader().getResourceAsStream("simpleNodes.md");
    assertThat( stream, IsNull.notNullValue());
    final InputStream inputStream = Site.processMarkdown(stream, "Test");
    assertThat( inputStream, IsNull.notNullValue());
    final String converted = IOUtils.toString(inputStream);

    assertThat("All forms of HRules should be supported", converted, containsString("----\n1\n----\n2\n----\n3\n----\n4\n----"));
    /* only when Extensions.SMARTS is activated
    assertThat(converted, containsString("&hellip;"));
    assertThat(converted, containsString("&ndash;"));
    assertThat(converted, containsString("&mdash;"));
    */
    assertThat(converted, containsString("Forcing a line-break\nNext line in the list"));
    assertThat(converted, containsString("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"));
}
 
開發者ID:bsorrentino,項目名稱:maven-confluence-plugin,代碼行數:18,代碼來源:SiteTest.java

示例7: shouldCreateSpecificNoticeBlock

import org.hamcrest.core.IsNull; //導入依賴的package包/類
@Test
public void shouldCreateSpecificNoticeBlock() throws IOException {
    final InputStream stream = getClass().getClassLoader().getResourceAsStream("createSpecificNoticeBlock.md");
    assertThat( stream, IsNull.notNullValue());
    final InputStream inputStream = Site.processMarkdown(stream, "Test Macro");
    assertThat( inputStream, IsNull.notNullValue());
    final String converted = IOUtils.toString(inputStream);

    assertThat(converted, containsString("{info:title=About me}\n"));
    assertThat("Should not generate unneeded param 'title'", converted, not(containsString("{note:title=}\n")));
    assertThat(converted, containsString("{tip:title=About you}\n"));
    assertThat(converted, containsString("bq. test a simple blockquote"));
    assertThat(converted, containsString("{quote}\n"));
    assertThat(converted, containsString("* one\n* two"));
    assertThat(converted, containsString("a *strong* and _pure_ feeling"));

}
 
開發者ID:bsorrentino,項目名稱:maven-confluence-plugin,代碼行數:18,代碼來源:SiteTest.java

示例8: initService

import org.hamcrest.core.IsNull; //導入依賴的package包/類
@Before
@Override
public void initService() throws Exception {
  
    super.initService();
    
    
    try {
        // SSL Implementation
        final SSLSocketFactory sslSocketFactory = SSLFactories.newInstance( new YesTrustManager());
        Assert.assertThat(sslSocketFactory, IsNull.notNullValue());
        
        final X509TrustManager trustManager = new YesTrustManager();
        final HostnameVerifier hostnameVerifier = new YesHostnameVerifier();
        
        service.client
                .hostnameVerifier(hostnameVerifier)
                .sslSocketFactory(sslSocketFactory, trustManager)
                ;
        
    } catch (Exception ex) {
        throw new IllegalStateException(ex);
    }
}
 
開發者ID:bsorrentino,項目名稱:maven-confluence-plugin,代碼行數:25,代碼來源:Issue130IntegrationTest.java

示例9: createClientId

import org.hamcrest.core.IsNull; //導入依賴的package包/類
/**
 * clientIdを作成する.
 * @return clientId
 * @throws Exception clientIdの作成に失敗した場合に発生
 */
private String createClientId() throws Exception {
    String uri = "http://localhost:4035/gotapi/authorization/grant";

    Map<String, String> headers = new HashMap<>();
    headers.put("Origin", getOrigin());

    HttpUtil.Response response = HttpUtil.get(uri, headers);
    assertThat(response, is(notNullValue()));

    JSONObject json = response.getJSONObject();
    assertThat(json, is(notNullValue()));
    assertThat(json.getInt("result"), is(0));
    assertThat(json.getString("clientId"), is(IsNull.notNullValue()));

    return json.getString("clientId");
}
 
開發者ID:DeviceConnect,項目名稱:DeviceConnect-Android,代碼行數:22,代碼來源:FailAuthorizationProfileTestCase.java

示例10: buyOrderOfCustomerWithEnoughCashAndKnownStock

import org.hamcrest.core.IsNull; //導入依賴的package包/類
@Test
public void buyOrderOfCustomerWithEnoughCashAndKnownStock() {
	Mockito.when(stockRepository.findOneByName(Matchers.anyString())).thenReturn(Optional.of(new Stock("TSLA", 10)));
	Mockito.when(customerRepository.findOne(Matchers.anyLong())).thenReturn(new Customer("Test user", 500));

	BuyOrder optional = buyOrderServiceActivator.processOrder(new BuyOrder("TSLA", 10, 1));
	assertThat(optional, is(IsNull.notNullValue()));

	Mockito.verify(stockRepository).findOneByName("TSLA");
	Mockito.verify(customerRepository).findOne(1L);

	ArgumentCaptor<Customer> customerArgumentCaptor = ArgumentCaptor.forClass(Customer.class);
	Mockito.verify(customerRepository).save(customerArgumentCaptor.capture());

	Customer customer = customerArgumentCaptor.getValue();
	assertThat(customer.getFreeCash(), is(400));
	assertThat(customer.getName(), is("Test user"));
	Mockito.verifyNoMoreInteractions(customerRepository, stockRepository);
}
 
開發者ID:gfoster-pivotal,項目名稱:spring-streaming-processing,代碼行數:20,代碼來源:BuyOrderServiceActivatorTest.java

示例11: shouldEasilyDoSimpleAtomicMutationMulti

import org.hamcrest.core.IsNull; //導入依賴的package包/類
@Test
public void shouldEasilyDoSimpleAtomicMutationMulti() throws Exception {
  ByteBuffer regionLocation = ByteBuffer.wrap(Bytes.toBytes("testTable"));
  RegionSpecifier regionSpecifier = new RegionSpecifier(RegionSpecifier.RegionSpecifierType.REGION_NAME,
      regionLocation);

  context.checking(new Expectations() {
    {
      oneOf(hRegionInterface).processRowsWithLocks(with(any(MultiRowMutationProcessor.class)));
    }
  });

  MutationProto mutation = ProtobufUtil.toMutation(MutationProto.MutationType.PUT, new Put(Bytes.toBytes("fakeRow")));

  RegionActionResult actions = hRegionBridge.processRegionAction(new RegionAction(regionSpecifier,
      true,
      Arrays.asList(new Action(0, mutation, null))));
  assertThat(actions.getException(), IsNull.nullValue());
  assertThat(actions.getResultOrExceptionList().size(), is(1));
}
 
開發者ID:cloud-software-foundation,項目名稱:c5,代碼行數:21,代碼來源:HRegionBridgeTest.java

示例12: shouldEasilyDoAtomicMutationOnlyMultiPut

import org.hamcrest.core.IsNull; //導入依賴的package包/類
@Test
public void shouldEasilyDoAtomicMutationOnlyMultiPut() throws Exception {
  ByteBuffer regionLocation = ByteBuffer.wrap(Bytes.toBytes("testTable"));
  RegionSpecifier regionSpecifier = new RegionSpecifier(RegionSpecifier.RegionSpecifierType.REGION_NAME,
      regionLocation);

  context.checking(new Expectations() {
    {
      oneOf(hRegionInterface).processRowsWithLocks(with(any(MultiRowMutationProcessor.class)));
    }
  });

  MutationProto mutation = ProtobufUtil.toMutation(MutationProto.MutationType.PUT, new Put(Bytes.toBytes("fakeRow")));

  RegionActionResult actions = hRegionBridge.processRegionAction(new RegionAction(regionSpecifier,
      true,
      Arrays.asList(
          new Action(0, mutation, null),
          new Action(1, mutation, null),
          new Action(2, mutation, null))
  ));
  assertThat(actions.getException(), IsNull.nullValue());
  assertThat(actions.getResultOrExceptionList().size(), is(3));
}
 
開發者ID:cloud-software-foundation,項目名稱:c5,代碼行數:25,代碼來源:HRegionBridgeTest.java

示例13: shouldEasilyDoAtomicMutationOnlyMultiDelete

import org.hamcrest.core.IsNull; //導入依賴的package包/類
@Test
public void shouldEasilyDoAtomicMutationOnlyMultiDelete() throws Exception {
  ByteBuffer regionLocation = ByteBuffer.wrap(Bytes.toBytes("testTable"));
  RegionSpecifier regionSpecifier = new RegionSpecifier(RegionSpecifier.RegionSpecifierType.REGION_NAME,
      regionLocation);

  context.checking(new Expectations() {
    {
      oneOf(hRegionInterface).processRowsWithLocks(with(any(MultiRowMutationProcessor.class)));
    }
  });

  MutationProto mutation = ProtobufUtil.toMutation(MutationProto.MutationType.DELETE, new Delete(Bytes.toBytes("fakeRow")));

  RegionActionResult actions = hRegionBridge.processRegionAction(new RegionAction(regionSpecifier,
      true,
      Arrays.asList(
          new Action(0, mutation, null),
          new Action(1, mutation, null),
          new Action(2, mutation, null))
  ));
  assertThat(actions.getException(), IsNull.nullValue());
  assertThat(actions.getResultOrExceptionList().size(), is(3));
}
 
開發者ID:cloud-software-foundation,項目名稱:c5,代碼行數:25,代碼來源:HRegionBridgeTest.java

示例14: shouldFailWhenWeTryToAtomicMutateAndGet

import org.hamcrest.core.IsNull; //導入依賴的package包/類
@Test
public void shouldFailWhenWeTryToAtomicMutateAndGet() throws Exception {
  ByteBuffer regionLocation = ByteBuffer.wrap(Bytes.toBytes("testTable"));
  RegionSpecifier regionSpecifier = new RegionSpecifier(RegionSpecifier.RegionSpecifierType.REGION_NAME,
      regionLocation);

  MutationProto mutation = ProtobufUtil.toMutation(MutationProto.MutationType.DELETE, new Delete(Bytes.toBytes("fakeRow")));
  Get get = ProtobufUtil.toGet(new org.apache.hadoop.hbase.client.Get(Bytes.toBytes("fakeRow2")), false);
  Get exists = ProtobufUtil.toGet(new org.apache.hadoop.hbase.client.Get(Bytes.toBytes("fakeRow2")), true);

  RegionActionResult actions = hRegionBridge.processRegionAction(new RegionAction(regionSpecifier,
      true,
      Arrays.asList(
          new Action(0, mutation, get),
          new Action(1, mutation, exists))
  ));
  assertThat(actions.getException(), IsNull.notNullValue());
  assertThat(actions.getResultOrExceptionList().size(), is(0));
}
 
開發者ID:cloud-software-foundation,項目名稱:c5,代碼行數:20,代碼來源:HRegionBridgeTest.java

示例15: shouldEasilyDoSimpleMutationMulti

import org.hamcrest.core.IsNull; //導入依賴的package包/類
@Test
public void shouldEasilyDoSimpleMutationMulti() throws Exception {
  ByteBuffer regionLocation = ByteBuffer.wrap(Bytes.toBytes("testTable"));
  RegionSpecifier regionSpecifier = new RegionSpecifier(RegionSpecifier.RegionSpecifierType.REGION_NAME,
      regionLocation);

  context.checking(new Expectations() {
    {
      oneOf(hRegionInterface).put(with(any(Put.class)));
    }
  });

  MutationProto mutation = ProtobufUtil.toMutation(MutationProto.MutationType.PUT, new Put(Bytes.toBytes("fakeRow")));

  RegionActionResult actions = hRegionBridge.processRegionAction(new RegionAction(regionSpecifier,
      false,
      Arrays.asList(new Action(0, mutation, null))));
  assertThat(actions.getException(), IsNull.nullValue());
  assertThat(actions.getResultOrExceptionList().size(), is(1));
}
 
開發者ID:cloud-software-foundation,項目名稱:c5,代碼行數:21,代碼來源:HRegionBridgeTest.java


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