本文整理了Java中org.assertj.core.api.ListAssert.containsExactly()
方法的一些代码示例,展示了ListAssert.containsExactly()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ListAssert.containsExactly()
方法的具体详情如下:
包路径:org.assertj.core.api.ListAssert
类名称:ListAssert
方法名:containsExactly
暂无
代码示例来源:origin: prestodb/presto
@Test(groups = CLI, timeOut = TIMEOUT)
public void shouldDisplayVersion()
throws IOException
{
launchPrestoCli("--version");
String version = firstNonNull(Presto.class.getPackage().getImplementationVersion(), "(version unknown)");
assertThat(presto.readRemainingOutputLines()).containsExactly("Presto CLI " + version);
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void toUniqueAndSortedList_removes_duplicates() {
assertThat(toUniqueAndSortedList(asList("A", "A", "A"))).containsExactly("A");
assertThat(toUniqueAndSortedList(asList("A", "C", "A"))).containsExactly("A", "C");
assertThat(toUniqueAndSortedList(asList("C", "C", "B", "B", "A", "N", "C", "A"))).containsExactly("A", "B", "C", "N");
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void read_multi_param_from_source_with_values() {
when(source.getParameterValues("param")).thenReturn(new String[]{"firstValue", "secondValue", "thirdValue"});
List<String> result = underTest.readMultiParam("param");
assertThat(result).containsExactly("firstValue", "secondValue", "thirdValue");
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void execute_calls_2_delegates_in_order() throws SQLException {
underTest.execute();
assertThat(calls).containsExactly(Call.CALL_1, Call.CALL_2);
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void shouldNormalizeHexIntegerLiteral() {
assertThat(chunk("0xFF")).containsExactly(NUMERIC_LITTERAL);
assertThat(chunk("0xFFl")).containsExactly(NUMERIC_LITTERAL);
assertThat(chunk("0xFFL")).containsExactly(NUMERIC_LITTERAL);
assertThat(chunk("0XFF")).containsExactly(NUMERIC_LITTERAL);
assertThat(chunk("0XFFl")).containsExactly(NUMERIC_LITTERAL);
assertThat(chunk("0XFFL")).containsExactly(NUMERIC_LITTERAL);
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void read_multi_param_from_source_with_one_value() {
when(source.getParameterValues("param")).thenReturn(new String[]{"firstValue"});
List<String> result = underTest.readMultiParam("param");
assertThat(result).containsExactly("firstValue");
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void verify_supports_components() {
assertThat(underTest.getSupportComponents()).containsExactly(
FixProjectUuidOfDeveloperProjects.class,
CleanUsurperRootComponents.class);
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void projectPermissions_must_be_ordered() {
assertThat(underTest.getAllProjectPermissions())
.containsExactly("admin", "codeviewer", "issueadmin", "securityhotspotadmin", "scan", "user");
}
}
代码示例来源:origin: SonarSource/sonarqube
/**
* <a href="http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.10.1">Integer Literals</a>
*/
@Test
public void shouldNormalizeDecimalIntegerLiteral() {
assertThat(chunk("543")).containsExactly(NUMERIC_LITTERAL);
assertThat(chunk("543l")).containsExactly(NUMERIC_LITTERAL);
assertThat(chunk("543L")).containsExactly(NUMERIC_LITTERAL);
}
代码示例来源:origin: SonarSource/sonarqube
/**
* New in Java 7.
*/
@Test
public void shouldNormalizeBinaryIntegerLiteral() {
assertThat(chunk("0b10")).containsExactly(NUMERIC_LITTERAL);
assertThat(chunk("0b10l")).containsExactly(NUMERIC_LITTERAL);
assertThat(chunk("0b10L")).containsExactly(NUMERIC_LITTERAL);
assertThat(chunk("0B10")).containsExactly(NUMERIC_LITTERAL);
assertThat(chunk("0B10l")).containsExactly(NUMERIC_LITTERAL);
assertThat(chunk("0B10L")).containsExactly(NUMERIC_LITTERAL);
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void toUniqueAndSortedList_enforces_natural_order() {
assertThat(toUniqueAndSortedList(asList("A", "B", "C"))).containsExactly("A", "B", "C");
assertThat(toUniqueAndSortedList(asList("B", "A", "C"))).containsExactly("A", "B", "C");
assertThat(toUniqueAndSortedList(asList("B", "C", "A"))).containsExactly("A", "B", "C");
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void shouldNormalizeOctalIntegerLiteral() {
assertThat(chunk("077")).containsExactly(NUMERIC_LITTERAL);
assertThat(chunk("077l")).containsExactly(NUMERIC_LITTERAL);
assertThat(chunk("077L")).containsExactly(NUMERIC_LITTERAL);
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void get_leaves_qualifiers() {
assertThat(types.getLeavesQualifiers(Qualifiers.PROJECT)).containsExactly(Qualifiers.FILE);
assertThat(types.getLeavesQualifiers(Qualifiers.DIRECTORY)).containsExactly(Qualifiers.FILE);
assertThat(types.getLeavesQualifiers(Qualifiers.VIEW)).containsExactly(Qualifiers.PROJECT);
assertThat(types.getLeavesQualifiers(Qualifiers.APP)).containsExactly(Qualifiers.PROJECT);
assertThat(types.getLeavesQualifiers("xxx")).isEmpty();
}
代码示例来源:origin: springside/springside4
@Test
public void topNAndBottomN() {
List<Integer> list = ArrayUtil.asList(3, 5, 7, 4, 2, 6, 9);
assertThat(CollectionUtil.topN(list, 3)).containsExactly(9, 7, 6);
assertThat(CollectionUtil.topN(list, 3, Ordering.natural().reverse())).containsExactly(2, 3, 4);
assertThat(CollectionUtil.bottomN(list, 3)).containsExactly(2, 3, 4);
assertThat(CollectionUtil.bottomN(list, 3, Ordering.natural().reverse())).containsExactly(9, 7, 6);
}
}
代码示例来源:origin: springside/springside4
@Test
public void collectionCalc() {
List<String> list1 = ListUtil.newArrayList("1", "2", "3", "6", "6");
List<String> list2 = ListUtil.newArrayList("4", "5", "6", "7", "6", "6");
List<String> result = ListUtil.union(list1, list2);
assertThat(result).containsExactly("1", "2", "3", "6", "6", "4", "5", "6", "7", "6", "6");
List<String> result2 = ListUtil.intersection(list1, list2);
assertThat(result2).containsExactly("6", "6");
List<String> result3 = ListUtil.difference(list2, list1);
assertThat(result3).containsExactly("4", "5", "7", "6");
List<String> result4 = ListUtil.disjoint(list1, list2);
assertThat(result4).containsExactly("1", "2", "3", "4", "5", "7", "6");
}
}
代码示例来源: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_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 openSession_without_caching_always_returns_a_new_batch_session_when_parameter_is_true() {
DbSession[] expected = {mock(DbSession.class), mock(DbSession.class), mock(DbSession.class), mock(DbSession.class)};
when(myBatis.openSession(true))
.thenReturn(expected[0])
.thenReturn(expected[1])
.thenReturn(expected[2])
.thenReturn(expected[3])
.thenThrow(oneCallTooMuch());
assertThat(Arrays.stream(expected).map(ignored -> underTest.openSession(true)).collect(MoreCollectors.toList()))
.containsExactly(expected);
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void openSession_without_caching_always_returns_a_new_regular_session_when_parameter_is_false() {
DbSession[] expected = {mock(DbSession.class), mock(DbSession.class), mock(DbSession.class), mock(DbSession.class)};
when(myBatis.openSession(false))
.thenReturn(expected[0])
.thenReturn(expected[1])
.thenReturn(expected[2])
.thenReturn(expected[3])
.thenThrow(oneCallTooMuch());
assertThat(Arrays.stream(expected).map(ignored -> underTest.openSession(false)).collect(MoreCollectors.toList()))
.containsExactly(expected);
}
内容来源于网络,如有侵权,请联系作者删除!