Search in sources :

Example 1 with IterableSubject

use of com.google.common.truth.IterableSubject in project gerrit by GerritCodeReview.

the class ProjectAssert method assertThatNameList.

public static IterableSubject assertThatNameList(Iterable<ProjectInfo> actualIt) {
    List<ProjectInfo> actual = ImmutableList.copyOf(actualIt);
    for (ProjectInfo info : actual) {
        assertWithMessage("missing project name").that(info.name).isNotNull();
        assertWithMessage("project name does not match id").that(Url.decode(info.id)).isEqualTo(info.name);
    }
    return assertThat(Iterables.transform(actual, p -> new Project.NameKey(p.name)));
}
Also used : Project(com.google.gerrit.reviewdb.client.Project) Iterables(com.google.common.collect.Iterables) Truth.assertWithMessage(com.google.common.truth.Truth.assertWithMessage) ProjectState(com.google.gerrit.server.project.ProjectState) Set(java.util.Set) Truth.assertThat(com.google.common.truth.Truth.assertThat) Strings(com.google.common.base.Strings) AccountGroup(com.google.gerrit.reviewdb.client.AccountGroup) List(java.util.List) ImmutableList(com.google.common.collect.ImmutableList) IterableSubject(com.google.common.truth.IterableSubject) Url(com.google.gerrit.extensions.restapi.Url) ProjectInfo(com.google.gerrit.extensions.common.ProjectInfo) ProjectInfo(com.google.gerrit.extensions.common.ProjectInfo)

Aggregations

Strings (com.google.common.base.Strings)1 ImmutableList (com.google.common.collect.ImmutableList)1 Iterables (com.google.common.collect.Iterables)1 IterableSubject (com.google.common.truth.IterableSubject)1 Truth.assertThat (com.google.common.truth.Truth.assertThat)1 Truth.assertWithMessage (com.google.common.truth.Truth.assertWithMessage)1 ProjectInfo (com.google.gerrit.extensions.common.ProjectInfo)1 Url (com.google.gerrit.extensions.restapi.Url)1 AccountGroup (com.google.gerrit.reviewdb.client.AccountGroup)1 Project (com.google.gerrit.reviewdb.client.Project)1 ProjectState (com.google.gerrit.server.project.ProjectState)1 List (java.util.List)1 Set (java.util.Set)1