• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Arrays类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.assertj.core.util.Arrays的典型用法代码示例。如果您正苦于以下问题:Java Arrays类的具体用法?Java Arrays怎么用?Java Arrays使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Arrays类属于org.assertj.core.util包,在下文中一共展示了Arrays类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: formatPrimitiveArray

import org.assertj.core.util.Arrays; //导入依赖的package包/类
protected String formatPrimitiveArray(Object o) {
  if (!isArray(o)) return null;
  if (!isArrayTypePrimitive(o)) throw Arrays.notAnArrayOfPrimitives(o);
  int size = getLength(o);
  if (size == 0) return DEFAULT_START + DEFAULT_END;
  StringBuilder buffer = new StringBuilder();
  buffer.append(DEFAULT_START);
  buffer.append(toStringOf(Array.get(o, 0)));
  for (int i = 1; i < size; i++) {
    buffer.append(ELEMENT_SEPARATOR)
          .append(INDENTATION_FOR_SINGLE_LINE);
    if (i == maxElementsForPrinting) {
      buffer.append(DEFAULT_MAX_ELEMENTS_EXCEEDED);
      break;
    }

    buffer.append(toStringOf(Array.get(o, i)));
  }
  buffer.append(DEFAULT_END);
  return buffer.toString();
}
 
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:22,代码来源:StandardRepresentation.java


示例2: shouldPrintVerboseResult

import org.assertj.core.util.Arrays; //导入依赖的package包/类
@Test
public void shouldPrintVerboseResult() {
    JacksonEvolutionResultConsumer<Integer> integerJacksonEvolutionResultConsumer = new JacksonEvolutionResultConsumer<Integer>();

    ComparisonResult<Integer> integerComparisonResult = new ComparisonResult<Integer>("testEvolution",
            ImplementationPreference.EVOLVED,
            new ProtoplastValueExecutionResult<Integer>(Arrays.array(1,2), 100, 6),
            new EvolvedValueExecutionResult<Integer>(Arrays.array(1,2), 130, 6),
            ResultType.OK);

    integerJacksonEvolutionResultConsumer.consumeResults(integerComparisonResult, ResultConsumerConfiguration.VERBOSE);
}
 
开发者ID:darwin-evolution,项目名称:darwin,代码行数:13,代码来源:JacksonEvolutionResultConsumerTest.java


示例3: shouldPrintSilentResult

import org.assertj.core.util.Arrays; //导入依赖的package包/类
@Test
public void shouldPrintSilentResult() {
    JacksonEvolutionResultConsumer<Integer> integerJacksonEvolutionResultConsumer = new JacksonEvolutionResultConsumer<Integer>();

    ComparisonResult<Integer> integerComparisonResult = new ComparisonResult<Integer>("testEvolution",
            ImplementationPreference.EVOLVED,
            new ProtoplastValueExecutionResult<Integer>(Arrays.array(1,2), 100, 6),
            new EvolvedValueExecutionResult<Integer>(Arrays.array(1,2), 130, 6),
            ResultType.OK);

    integerJacksonEvolutionResultConsumer.consumeResults(integerComparisonResult, ResultConsumerConfiguration.SILENT);
}
 
开发者ID:darwin-evolution,项目名称:darwin,代码行数:13,代码来源:JacksonEvolutionResultConsumerTest.java


示例4: createIntegerOkExceptionsComparisonResult

import org.assertj.core.util.Arrays; //导入依赖的package包/类
private static ComparisonResult<Integer> createIntegerOkExceptionsComparisonResult() {
    return new ComparisonResult<Integer>("testEvolution",
                ImplementationPreference.EVOLVED,
                new ProtoplastExceptionExecutionResult<Integer>(Arrays.array(-1,-2), 100, new Exception("fasd")),
                new EvolvedExceptionExecutionResult<Integer>(Arrays.array(-1,-2), 130, new Exception("fdsa")),
                ResultType.OK_EXCEPTIONS);
}
 
开发者ID:darwin-evolution,项目名称:darwin,代码行数:8,代码来源:Slf4jEvolutionResultConsumerTest.java


示例5: createIntegerValueOkComparisonResult

import org.assertj.core.util.Arrays; //导入依赖的package包/类
private static ComparisonResult<Integer> createIntegerValueOkComparisonResult() {
    return new ComparisonResult<Integer>("testEvolution",
            ImplementationPreference.EVOLVED,
            new ProtoplastValueExecutionResult<Integer>(Arrays.array(-1,-2), 100, -6),
            new EvolvedValueExecutionResult<Integer>(Arrays.array(-1,-2), 130, -6),
            ResultType.OK);
}
 
开发者ID:darwin-evolution,项目名称:darwin,代码行数:8,代码来源:Slf4jEvolutionResultConsumerTest.java


示例6: should_convert_sequence_of_blank_strings_to_empty_string_array

import org.assertj.core.util.Arrays; //导入依赖的package包/类
@Test
public void should_convert_sequence_of_blank_strings_to_empty_string_array() throws Exception {
    // given
    StateTypeConverter typeConverter = new StateTypeConverter();
    String[] arrayOfEmptyStrings = Arrays.array("", "", "", "", "");

    // when
    String[] convertedStringArray = typeConverter.convert(" ,   ,   ,   ,       ", String[].class);

    // then
    assertThat(convertedStringArray).isEqualTo(arrayOfEmptyStrings);
}
 
开发者ID:arquillian,项目名称:arquillian-algeron,代码行数:13,代码来源:StateTypeConverterTest.java


示例7: should_convert_single_element_to_one_element_array

import org.assertj.core.util.Arrays; //导入依赖的package包/类
@Test
public void should_convert_single_element_to_one_element_array() throws Exception {
    // given
    StateTypeConverter typeConverter = new StateTypeConverter();
    String[] singleElementArray = Arrays.array("one element");

    // when
    String[] convertedStringArray = typeConverter.convert("one element", String[].class);

    // then
    assertThat(convertedStringArray).isEqualTo(singleElementArray);
}
 
开发者ID:arquillian,项目名称:arquillian-algeron,代码行数:13,代码来源:StateTypeConverterTest.java


示例8: should_convert_single_element_with_delimiter_to_one_element_array

import org.assertj.core.util.Arrays; //导入依赖的package包/类
@Test
public void should_convert_single_element_with_delimiter_to_one_element_array() throws Exception {
    // given
    StateTypeConverter typeConverter = new StateTypeConverter();
    String[] singleElementArray = Arrays.array("one element");

    // when
    String[] convertedStringArray = typeConverter.convert("one element,", String[].class);

    // then
    assertThat(convertedStringArray).isEqualTo(singleElementArray);
}
 
开发者ID:arquillian,项目名称:arquillian-algeron,代码行数:13,代码来源:StateTypeConverterTest.java


示例9: should_convert_single_element_with_delimiters_to_one_element_array

import org.assertj.core.util.Arrays; //导入依赖的package包/类
@Test
public void should_convert_single_element_with_delimiters_to_one_element_array() throws Exception {
    // given
    StateTypeConverter typeConverter = new StateTypeConverter();
    String[] singleElementArray = Arrays.array("one element");

    // when
    String[] convertedStringArray = typeConverter.convert("one element,,,,,,,", String[].class);

    // then
    assertThat(convertedStringArray).isEqualTo(singleElementArray);
}
 
开发者ID:arquillian,项目名称:arquillian-algeron,代码行数:13,代码来源:StateTypeConverterTest.java


示例10: should_convert_blank_to_empty_string_when_appear_in_sequence_with_non_blanks

import org.assertj.core.util.Arrays; //导入依赖的package包/类
@Test
public void should_convert_blank_to_empty_string_when_appear_in_sequence_with_non_blanks() throws Exception {
    // given
    StateTypeConverter typeConverter = new StateTypeConverter();
    String[] expectedArray = Arrays.array("a", "", "test", "", "", "b");
    // when
    String[] convertedStringArray = typeConverter.convert("a,   , test  ,   ,      , b ", String[].class);

    // then
    assertThat(convertedStringArray).isEqualTo(expectedArray);
}
 
开发者ID:arquillian,项目名称:arquillian-algeron,代码行数:12,代码来源:StateTypeConverterTest.java


示例11: testingCombiningNestedObservables

import org.assertj.core.util.Arrays; //导入依赖的package包/类
@Test
public void testingCombiningNestedObservables() {
    Observable<String> observable1 = Observable.from(Arrays.array(1, 2, 3, 4, 5, 6, 7, 8, 9)).map(el -> "a" + el);
    Observable<String> observable2 = Observable.from(Arrays.array(10, 20, 30, 40, 50, 60, 70, 80, 90)).map(el -> "a" + el);
    Observable<Observable<String>> observableObservable =
            Observable.from(new Observable[]{observable1, observable2});
    Observable<String> mergedObservable = Observable.merge(observableObservable);
    mergedObservable.subscribe(System.out::println);
}
 
开发者ID:ordina-jworks,项目名称:microservices-dashboard-server,代码行数:10,代码来源:ObservableTests.java


示例12: testingCombiningNestedObservablesWithLatency

import org.assertj.core.util.Arrays; //导入依赖的package包/类
@Test
public void testingCombiningNestedObservablesWithLatency() throws InterruptedException {
    final CountDownLatch latch = new CountDownLatch(19);
    Observable<String> observable1 = Observable.interval(1L, SECONDS).map(el -> "a" + el).take(10);
    Observable<String> observable2 = Observable.from(Arrays.array(10L, 20L, 30L, 40L, 50L, 60L, 70L, 80L, 90L)).map(el -> "b" + el);
    Observable<Observable<String>> observableObservable =
            Observable.from(new Observable[] { observable1, observable2 });
    Observable<String> mergedObservable = Observable.merge(observableObservable);
    mergedObservable.subscribe((x) -> {
        latch.countDown();
        System.out.println(x);
    });
    latch.await();
}
 
开发者ID:ordina-jworks,项目名称:microservices-dashboard-server,代码行数:15,代码来源:ObservableTests.java


示例13: testYahooFinanceRealtimeTwo

import org.assertj.core.util.Arrays; //导入依赖的package包/类
@Test
public void testYahooFinanceRealtimeTwo() throws Exception {
  String body = doRestQuery(realtimeUrl, format("%s+%s", tickerA.getRicAsString(), tickerB.getRicAsString()));
  logger.info("and the response body should be parseable as a YahooFinanceRealtime object");
  List<YahooFinanceRealtime> yfrs = YahooFinanceRealtime.of(OffsetDateTime.now(), body.split("\\n"),
      Arrays.array(tickerA, tickerB));
  assertThat(yfrs).hasSize(2);
}
 
开发者ID:the-james-burton,项目名称:the-turbine,代码行数:9,代码来源:FinanceControllerIT.java


示例14: withJpaServer

import org.assertj.core.util.Arrays; //导入依赖的package包/类
@Test
public void withJpaServer() {
    load(
            Arrays.array(
                    EmbeddedDataSourceConfiguration.class,
                    HibernateJpaAutoConfiguration.class,
                    PropertyPlaceholderAutoConfiguration.class,
                    FhirAutoConfiguration.class),
            "hapi.fhir.version:DSTU3",
            "spring.jpa.properties.hibernate.search.default.indexBase:target/lucenefiles",
 		 "spring.jpa.properties.hibernate.search.model_mapping:ca.uhn.fhir.jpa.search.LuceneSearchMappingFactory");
    assertThat(this.context.getBeansOfType(DaoConfig.class)).hasSize(1);
    assertThat(this.context.getBeansOfType(Dstu3.class)).hasSize(1);
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:15,代码来源:FhirAutoConfigurationTest.java


示例15: assertIsAssignableFrom

import org.assertj.core.util.Arrays; //导入依赖的package包/类
/**
 * Verifies that the actual {@code Class} is assignable from all the {@code others} classes.
 *
 * @param info contains information about the assertion.
 * @param actual the "actual" {@code Class}.
 * @param others the others {@code Class} who this actual class must be assignable.
 * @throws NullPointerException if one of the {@code others} is {@code null}.
 * @throws AssertionError if {@code actual} is {@code null}.
 * @throws AssertionError if the actual {@code Class} is not assignable from all of the {@code others} classes.
 */
public void assertIsAssignableFrom(AssertionInfo info, Class<?> actual, Class<?>... others) {
  assertNotNull(info, actual);
  checkArgument(!Arrays.isNullOrEmpty(others), "Expecting at least one Class to be specified");

  Set<Class<?>> expected = newLinkedHashSet(others);
  Set<Class<?>> missing = new LinkedHashSet<>();
  for (Class<?> other : expected) {
    classParameterIsNotNull(other);
    if (!actual.isAssignableFrom(other)) missing.add(other);
  }

  if (!missing.isEmpty()) throw failures.failure(info, shouldBeAssignableFrom(actual, expected, missing));
}
 
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:24,代码来源:Classes.java


示例16: contextLoads

import org.assertj.core.util.Arrays; //导入依赖的package包/类
@Test
public void contextLoads() {
       JavaRestBooksApplication.main(Arrays.array());
}
 
开发者ID:sbouclier,项目名称:java-rest-books,代码行数:5,代码来源:JavaRestBooksApplicationTests.java


示例17: emittedValuesShouldMatchCheckInOrder

import org.assertj.core.util.Arrays; //导入依赖的package包/类
@Test
public void emittedValuesShouldMatchCheckInOrder() {
    assertThatSubscriberTo(Observable.from(Arrays.array(1,2,3)))
            .hasValues(1, 2, 3);
}
 
开发者ID:nomisRev,项目名称:RxAssertJ,代码行数:6,代码来源:RxAssertionsTests.java


示例18: wrongOrderingValueCheckShouldFail

import org.assertj.core.util.Arrays; //导入依赖的package包/类
@Test(expected = AssertionError.class)
public void wrongOrderingValueCheckShouldFail() {
    assertThatSubscriberTo(Observable.from(Arrays.array(1,2,3)))
            .hasValues(1, 3, 2);
}
 
开发者ID:nomisRev,项目名称:RxAssertJ,代码行数:6,代码来源:RxAssertionsTests.java


示例19: testProcessProgramArgsUnknowOption

import org.assertj.core.util.Arrays; //导入依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void testProcessProgramArgsUnknowOption() {

	programOptionsService.processProgramArgs(Arrays.array("-u"));
}
 
开发者ID:Sylvain-Bugat,项目名称:aws-ec2-start-stop-tools,代码行数:6,代码来源:ProgramOptionsServiceTest.java


示例20: testProcessProgramArgsAllExclusiveOptions

import org.assertj.core.util.Arrays; //导入依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void testProcessProgramArgsAllExclusiveOptions() {

	programOptionsService.processProgramArgs(Arrays.array("-lepc"));
}
 
开发者ID:Sylvain-Bugat,项目名称:aws-ec2-start-stop-tools,代码行数:6,代码来源:ProgramOptionsServiceTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ClusterEvaluation类代码示例发布时间:2022-05-22
下一篇:
Java Option类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap