本文整理了Java中org.assertj.core.api.IterableAssert.containsExactly()
方法的一些代码示例,展示了IterableAssert.containsExactly()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IterableAssert.containsExactly()
方法的具体详情如下:
包路径:org.assertj.core.api.IterableAssert
类名称:IterableAssert
方法名:containsExactly
暂无
代码示例来源:origin: SonarSource/sonarqube
@Test
public void getMetricKeys_includes_by_default_new_lines() {
QualityGate gate = mock(QualityGate.class);
assertThat(underTest.getMetricKeys(gate)).containsExactly(NEW_LINES_KEY);
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void should_find_files_per_module_and_globally() throws IOException {
InputComponentStoreTester tester = new InputComponentStoreTester();
String mod1Key = "mod1";
InputFile mod1File = tester.addFile(mod1Key, "src/main/java/Foo.java", "java");
String mod2Key = "mod2";
InputFile mod2File = tester.addFile(mod2Key, "src/main/groovy/Foo.groovy", "groovy");
assertThat(tester.filesByModule(mod1Key)).containsExactly(mod1File);
assertThat(tester.filesByModule(mod2Key)).containsExactly(mod2File);
assertThat(tester.inputFiles()).containsExactlyInAnyOrder(mod1File, mod2File);
}
}
代码示例来源:origin: SonarSource/sonarqube
private void assertMultiValueParameters(MapEntry<String, List<String>>... expectedParameters) {
Parameters parameters = underTest.getParameters();
String[] expectedKeys = Arrays.stream(expectedParameters).map(MapEntry::getKey).toArray(String[]::new);
assertThat(parameters.getKeys()).containsExactly(expectedKeys);
Arrays.stream(expectedParameters).forEach(expectedParameter -> {
assertThat(parameters.getValues(expectedParameter.getKey())).containsExactly(expectedParameter.getValue().toArray(new String[0]));
});
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void getIndexTypes() {
assertThat(underTest.getIndexTypes()).containsExactly(INDEX_TYPE_ACTIVE_RULE);
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void should_add_languages_per_module_and_globally() throws IOException {
InputComponentStoreTester tester = new InputComponentStoreTester();
String mod1Key = "mod1";
tester.addFile(mod1Key, "src/main/java/Foo.java", "java");
String mod2Key = "mod2";
tester.addFile(mod2Key, "src/main/groovy/Foo.groovy", "groovy");
assertThat(tester.languages(mod1Key)).containsExactly("java");
assertThat(tester.languages(mod2Key)).containsExactly("groovy");
assertThat(tester.languages()).containsExactlyInAnyOrder("java", "groovy");
}
代码示例来源:origin: SonarSource/sonarqube
@SafeVarargs
private final <T extends Duplicate> void assertGetDuplicatesSorting(T... expected) {
Duplication duplication = new Duplication(SOME_ORIGINAL_TEXTBLOCK, shuffledList(expected));
assertThat(duplication.getDuplicates()).containsExactly(expected);
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void test_getIndexTypes() {
assertThat(underTest.getIndexTypes()).containsExactly(INDEX_TYPE_ISSUE);
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void selectUuidsOfOrganizationsWithoutDefaultProfile() {
OrganizationDto org1 = dbTester.organizations().insert();
OrganizationDto org2 = dbTester.organizations().insert();
QProfileDto profileInOrg1 = dbTester.qualityProfiles().insert(org1, p -> p.setLanguage("java"));
QProfileDto profileInOrg2 = dbTester.qualityProfiles().insert(org2, p -> p.setLanguage("java"));
dbTester.qualityProfiles().setAsDefault(profileInOrg1);
assertThat(underTest.selectUuidsOfOrganizationsWithoutDefaultProfile(dbSession, "java"))
.containsExactly(org2.getUuid());
assertThat(underTest.selectUuidsOfOrganizationsWithoutDefaultProfile(dbSession, "js"))
.containsExactlyInAnyOrder(org1.getUuid(), org2.getUuid());
}
代码示例来源:origin: spring-projects/spring-security
private void assertLoaded() throws Exception {
Collection<UserDetails> users = factory.getObject();
UserDetails expectedUser = User.withUsername("user")
.password("password")
.authorities("ROLE_USER")
.build();
assertThat(users).containsExactly(expectedUser);
}
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void test_getIndexTypes() {
assertThat(underTest.getIndexTypes()).containsExactly(INDEX_TYPE_COMPONENT);
}
代码示例来源:origin: spring-projects/spring-security
@Test
public void convertWhenTokenHasBothScopeAndScpThenScopeAttributeIsTranslatedToAuthorities() {
Map<String, Object> claims = new HashMap<>();
claims.put("scp", Arrays.asList("message:read", "message:write"));
claims.put("scope", "missive:read missive:write");
Jwt jwt = this.jwt(claims);
Collection<GrantedAuthority> authorities = this.jwtGrantedAuthoritiesConverter.convert(jwt);
assertThat(authorities).containsExactly(
new SimpleGrantedAuthority("SCOPE_missive:read"),
new SimpleGrantedAuthority("SCOPE_missive:write"));
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void validate_and_sanitize_collection_of_tags() {
assertThat(RuleTagFormat.validate(asList("style", "coding-style", ""))).containsExactly("coding-style", "style");
assertThat(RuleTagFormat.validate(asList("style", "coding-style", null))).containsExactly("coding-style", "style");
assertThat(RuleTagFormat.validate(asList("style", "style", null))).containsExactly("style");
assertThat(RuleTagFormat.validate(singletonList("Uppercase"))).containsExactly("uppercase");
assertThat(RuleTagFormat.validate(Collections.emptyList())).isEmpty();
}
代码示例来源:origin: spring-projects/spring-security
@Test
public void convertWhenTokenHasEmptyScopeAndNonEmptyScpThenScopeAttributeIsTranslatedToNoAuthorities() {
Map<String, Object> claims = new HashMap<>();
claims.put("scp", Arrays.asList("message:read", "message:write"));
claims.put("scope", "");
Jwt jwt = this.jwt(claims);
Collection<GrantedAuthority> authorities = this.jwtGrantedAuthoritiesConverter.convert(jwt);
assertThat(authorities).containsExactly();
}
代码示例来源:origin: spring-projects/spring-security
@Test
public void convertWhenTokenHasScpAttributeThenTranslatedToAuthorities() {
Jwt jwt = this.jwt(Collections.singletonMap("scp", Arrays.asList("message:read", "message:write")));
Collection<GrantedAuthority> authorities = this.jwtGrantedAuthoritiesConverter.convert(jwt);
assertThat(authorities).containsExactly(
new SimpleGrantedAuthority("SCOPE_message:read"),
new SimpleGrantedAuthority("SCOPE_message:write"));
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void toHashSet_with_size_builds_an_ArrayList() {
Set<Integer> res = Arrays.asList(1, 2, 3, 4, 5).stream().collect(toHashSet(30));
assertThat(res).isInstanceOf(HashSet.class)
.containsExactly(1, 2, 3, 4, 5);
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void toSet_builds_an_ImmutableSet() {
Set<Integer> res = Arrays.asList(1, 2, 3, 4, 5).stream().collect(toSet());
assertThat(res).isInstanceOf(ImmutableSet.class)
.containsExactly(1, 2, 3, 4, 5);
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void toHashSet_builds_an_HashSet() {
Set<Integer> res = Arrays.asList(1, 2, 3, 4, 5).stream().collect(toHashSet());
assertThat(res).isInstanceOf(HashSet.class)
.containsExactly(1, 2, 3, 4, 5);
}
代码示例来源:origin: spring-projects/spring-security
@Test
public void convertWhenTokenHasScopeAttributeThenTranslatedToAuthorities() {
Jwt jwt = this.jwt(Collections.singletonMap("scope", "message:read message:write"));
Collection<GrantedAuthority> authorities = this.jwtGrantedAuthoritiesConverter.convert(jwt);
assertThat(authorities).containsExactly(
new SimpleGrantedAuthority("SCOPE_message:read"),
new SimpleGrantedAuthority("SCOPE_message:write"));
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void toSet_with_size_builds_an_ImmutableSet() {
Set<Integer> res = Stream.of(1, 2, 3, 4, 5).collect(toSet(30));
assertThat(res).isInstanceOf(ImmutableSet.class)
.containsExactly(1, 2, 3, 4, 5);
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void toEnumSet() {
Set<MyEnum> res = Stream.of(MyEnum.ONE, MyEnum.ONE, MyEnum.TWO).collect(MoreCollectors.toEnumSet(MyEnum.class));
assertThat(res).isInstanceOf(EnumSet.class)
.containsExactly(MyEnum.ONE, MyEnum.TWO);
}
内容来源于网络,如有侵权,请联系作者删除!