Skip to content

Commit

Permalink
For #1333: Review changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulodamaso committed Aug 23, 2018
1 parent 95b7dae commit 5bb3bfe
Showing 1 changed file with 108 additions and 0 deletions.
108 changes: 108 additions & 0 deletions src/test/java/com/zerocracy/pmo/CatalogTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,42 @@
*/
package com.zerocracy.pmo;

import com.jcabi.aspects.Tv;
import com.jcabi.github.Github;
import com.jcabi.github.Repo;
import com.jcabi.github.Repos;
import com.jcabi.github.mock.MkGithub;
import com.zerocracy.Item;
import com.zerocracy.Project;
import com.zerocracy.Xocument;
import com.zerocracy.cash.Cash;
import com.zerocracy.farm.fake.FkFarm;
import com.zerocracy.farm.fake.FkProject;
import com.zerocracy.pm.in.Orders;
import com.zerocracy.pm.scope.Wbs;
import com.zerocracy.pm.staff.Roles;
import com.zerocracy.radars.github.Job;
import java.io.IOException;
import org.cactoos.text.FormattedText;
import org.cactoos.time.DateAsText;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.hamcrest.collection.IsEmptyIterable;
import org.hamcrest.core.IsEqual;
import org.hamcrest.core.IsNot;
import org.junit.Ignore;
import org.junit.Test;
import org.xembly.Directives;

/**
* Test case for {@link Catalog}.
* @since 1.0
* @todo #1333:30min Board page is slow, load all project properties present in
* board page in catalog.xml similar it is made in team page. After this,
* uncomment test catalogHasBoardPageInfo
* @checkstyle JavadocMethodCheck (500 lines)
* @checkstyle ClassDataAbstractionCouplingCheck (500 lines)
* @checkstyle ExecutableStatementCountCheck (500 lines)
*/
@SuppressWarnings("PMD.AvoidDuplicateLiterals")
public final class CatalogTest {
Expand Down Expand Up @@ -172,6 +190,96 @@ public void changeAdviser() throws Exception {
);
}

@Test
@Ignore
public void catalogHasBoardPageInfo() throws Exception {
final FkProject project = new FkProject();
new Catalog(new FkFarm(project)).bootstrap();
final Github github = new MkGithub();
final Repo repo = github.repos().create(
new Repos.RepoCreate("test", false)
);
final String arc = "yegor256";
final String dev = "paulodamaso";
final Roles roles = new Roles(project).bootstrap();
roles.assign(arc, "ARC");
roles.assign(dev, "DEV");
final Wbs wbs = new Wbs(project).bootstrap();
final String one = new Job(
repo.issues().create("Job number one", "")
).toString();
wbs.add(one);
wbs.add(
new Job(
repo.issues().create("Job number two", "")
).toString()
);
wbs.add(
new Job(
repo.issues().create("Job number three", "")
).toString()
);
new Orders(project).bootstrap().assign(
one,
dev,
Tv.TEN
);
try (final Item item = CatalogTest.item(project)) {
MatcherAssert.assertThat(
"Architect not found",
new Xocument(item.path()).xpath(
new FormattedText(
"/catalog/project[@id='%s']/architect",
project.pid()
).asString()
),
new IsEqual<>(arc)
);
MatcherAssert.assertThat(
"Members not found",
new Xocument(item.path()).xpath(
new FormattedText(
"/catalog/project[@id='%s']/members",
project.pid()
).asString()
),
new IsEqual<>(dev)
);
MatcherAssert.assertThat(
"Jobs not found",
new Xocument(item.path()).xpath(
new FormattedText(
"/catalog/project[@id='%s']/jobs",
project.pid()
).asString()
),
new IsNot<>(
new IsEmptyIterable<>()
)
);
MatcherAssert.assertThat(
"Assigned jobs not found",
new Xocument(item.path()).xpath(
new FormattedText(
"/catalog/project[@id='%s']/jobs[@assigned]",
project.pid()
).asString()
),
new IsEqual<>(1)
);
MatcherAssert.assertThat(
"Assigned jobs not found",
new Xocument(item.path()).xpath(
new FormattedText(
"/catalog/project[@id='%s']/jobs[@total]",
project.pid()
).asString()
),
new IsEqual<>(Tv.THREE)
);
}
}

private static Item item(final Project project) throws IOException {
return project.acq("catalog.xml");
}
Expand Down

0 comments on commit 5bb3bfe

Please sign in to comment.