org.assertj.core.api.ListAssert.isInstanceOf()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(138)

本文整理了Java中org.assertj.core.api.ListAssert.isInstanceOf()方法的一些代码示例,展示了ListAssert.isInstanceOf()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ListAssert.isInstanceOf()方法的具体详情如下:
包路径:org.assertj.core.api.ListAssert
类名称:ListAssert
方法名:isInstanceOf

ListAssert.isInstanceOf介绍

暂无

代码示例

代码示例来源:origin: SonarSource/sonarqube

@Test
public void toArrayList_with_size_builds_an_ArrayList() {
 List<Integer> res = Arrays.asList(1, 2, 3, 4, 5).stream().collect(toArrayList(30));
 assertThat(res).isInstanceOf(ArrayList.class)
  .containsExactly(1, 2, 3, 4, 5);
}

代码示例来源:origin: SonarSource/sonarqube

@Test
public void toList_builds_an_ImmutableList() {
 List<Integer> res = Arrays.asList(1, 2, 3, 4, 5).stream().collect(toList());
 assertThat(res).isInstanceOf(ImmutableList.class)
  .containsExactly(1, 2, 3, 4, 5);
}

代码示例来源:origin: SonarSource/sonarqube

@Test
public void toList_with_size_builds_an_ImmutableList() {
 List<Integer> res = Arrays.asList(1, 2, 3, 4, 5).stream().collect(toList(30));
 assertThat(res).isInstanceOf(ImmutableList.class)
  .containsExactly(1, 2, 3, 4, 5);
}

代码示例来源:origin: SonarSource/sonarqube

@Test
public void toArrayList_builds_an_ArrayList() {
 List<Integer> res = Arrays.asList(1, 2, 3, 4, 5).stream().collect(toArrayList());
 assertThat(res).isInstanceOf(ArrayList.class)
  .containsExactly(1, 2, 3, 4, 5);
}

代码示例来源:origin: org.apache.james/james-server-util-java8

@Test
public void immutableListCollectorShouldReturnEmptyImmutableListWhenEmptyStream() {
  String[] data = {};
  List<String> actual = Arrays.stream(data)
    .collect(Guavate.toImmutableList());
  assertThat(actual).isInstanceOf(ImmutableList.class);
  assertThat(actual).isEmpty();
}

代码示例来源:origin: apache/james-project

@Test
void immutableListCollectorShouldReturnEmptyImmutableListWhenEmptyStream() {
  String[] data = {};
  List<String> actual = Arrays.stream(data)
    .collect(Guavate.toImmutableList());
  assertThat(actual).isInstanceOf(ImmutableList.class);
  assertThat(actual).isEmpty();
}

代码示例来源:origin: apache/james-project

@Test
void immutableListCollectorShouldReturnImmutableListWhen3ElementsStream() {
  String[] data = {"a", "b", "c"};
  List<String> actual = Arrays.stream(data)
    .collect(Guavate.toImmutableList());
  assertThat(actual).isInstanceOf(ImmutableList.class);
  assertThat(actual).containsExactly("a", "b", "c");
}

代码示例来源:origin: org.apache.james/james-server-util-java8

@Test
public void immutableListCollectorShouldReturnImmutableListWhen3ElementsStream() {
  String[] data = {"a", "b", "c"};
  List<String> actual = Arrays.stream(data)
    .collect(Guavate.toImmutableList());
  assertThat(actual).isInstanceOf(ImmutableList.class);
  assertThat(actual).containsExactly("a", "b", "c");
}

代码示例来源:origin: org.apache.james/james-server-util-java8

@Test
public void immutableListCollectorShouldReturnImmutableListWhenOneElementStream() {
  String[] data = {"a"};
  List<String> actual = Arrays.stream(data)
    .collect(Guavate.toImmutableList());
  assertThat(actual).isInstanceOf(ImmutableList.class);
  assertThat(actual).containsExactly("a");
}

代码示例来源:origin: apache/james-project

@Test
void immutableListCollectorShouldReturnImmutableListWhenOneElementStream() {
  String[] data = {"a"};
  List<String> actual = Arrays.stream(data)
    .collect(Guavate.toImmutableList());
  assertThat(actual).isInstanceOf(ImmutableList.class);
  assertThat(actual).containsExactly("a");
}

代码示例来源:origin: WojciechZankowski/iextrading4j

@Test
public void shouldCreateImmutableListFromList() {
  final List<String> mutableList = new ArrayList<>();
  final List<String> immutableList = ListUtil.immutableList(mutableList);
  assertThat(immutableList).isInstanceOf(ImmutableList.class);
}

代码示例来源:origin: PegaSysEng/pantheon

@Override
 public void verify(final Node node) {
  final List<String> response = node.execute(transaction);
  assertThat(response).isInstanceOf(List.class);
  assertThat(response).size().isEqualTo(expectedNodeNum);
 }
}

代码示例来源:origin: sta-szek/pojo-tester

@Test
  void Should_Return_Any_Instance_When_Value_Is_Empty() {
    // given
    final LinkedList<String> value = new LinkedList<>();
    final Class<LinkedList> type = LinkedList.class;

    final LinkedListValueChanger valueChanger = new LinkedListValueChanger();

    // when
    final LinkedList<?> result = valueChanger.increaseValue(value, type);

    // then
    assertThat(result).isInstanceOf(type);
  }
}

代码示例来源:origin: sta-szek/pojo-tester

@Test
  void Should_Return_Any_Instance_When_Value_Is_Empty() {
    // given
    final Stack<String> value = new Stack<>();
    final Class<Stack> type = Stack.class;

    final StackValueChanger valueChanger = new StackValueChanger();

    // when
    final Stack<?> result = valueChanger.increaseValue(value, type);

    // then
    assertThat(result).isInstanceOf(type);
  }
}

代码示例来源:origin: sta-szek/pojo-tester

@Test
void Should_Return_Any_Instance_When_Value_Is_Null() {
  // given
  final LinkedList<String> value = null;
  final Class<LinkedList> type = LinkedList.class;
  final LinkedListValueChanger valueChanger = new LinkedListValueChanger();
  // when
  final LinkedList<?> result = valueChanger.increaseValue(value, type);
  // then
  assertThat(result).isInstanceOf(type);
}

代码示例来源:origin: sta-szek/pojo-tester

@Test
void Should_Return_Any_Instance_When_Value_Is_Null() {
  // given
  final Vector<String> value = null;
  final Class<Vector> type = Vector.class;
  final VectorValueChanger valueChanger = new VectorValueChanger();
  // when
  final Vector<?> result = valueChanger.increaseValue(value, type);
  // then
  assertThat(result).isInstanceOf(type);
}

代码示例来源:origin: sta-szek/pojo-tester

@Test
void Should_Return_Any_Instance_When_Value_Is_Null() {
  // given
  final Stack<String> value = null;
  final Class<Stack> type = Stack.class;
  final StackValueChanger valueChanger = new StackValueChanger();
  // when
  final Stack<?> result = valueChanger.increaseValue(value, type);
  // then
  assertThat(result).isInstanceOf(type);
}

代码示例来源:origin: sta-szek/pojo-tester

@Test
void Should_Return_Any_Instance_When_Value_Is_Null() {
  // given
  final ArrayList<String> value = null;
  final Class<ArrayList> type = ArrayList.class;
  final ArrayListValueChanger valueChanger = new ArrayListValueChanger();
  // when
  final ArrayList<?> result = valueChanger.increaseValue(value, type);
  // then
  assertThat(result).isInstanceOf(type);
}

代码示例来源:origin: atlanmod/NeoEMF

@ParameterizedTest
@ArgumentsSource(ContextProvider.All.class)
void testGetMapStringStringEmpty(Context context) throws IOException {
  try (PersistentResource resource = createPersistentResource(context)) {
    resource.getContents().add(EFACTORY.createETypes());
    ETypes eTypes = (ETypes) resource.getContents().get(0);
    assertThat(eTypes.getStringValues()).isInstanceOf(EMap.class);
    EMap<String, String> map = eTypes.getStringValues();
    assertThat(map).isEmpty();
  }
}

代码示例来源:origin: atlanmod/NeoEMF

@ParameterizedTest
@ArgumentsSource(ContextProvider.All.class)
void testGetMapKVEmpty(Context context) throws IOException {
  try (PersistentResource resource = createPersistentResource(context)) {
    resource.getContents().add(EFACTORY.createETypes());
    ETypes eTypes = (ETypes) resource.getContents().get(0);
    assertThat(eTypes.getValues()).isInstanceOf(EMap.class);
    EMap<Type, Value> map = eTypes.getValues();
    assertThat(map).isEmpty();
  }
}

相关文章

微信公众号

最新文章

更多

ListAssert类方法