本文整理汇总了Java中org.fest.assertions.api.Assertions类的典型用法代码示例。如果您正苦于以下问题:Java Assertions类的具体用法?Java Assertions怎么用?Java Assertions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Assertions类属于org.fest.assertions.api包,在下文中一共展示了Assertions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: assertAllUrlActions
import org.fest.assertions.api.Assertions; //导入依赖的package包/类
private void assertAllUrlActions(List<List<FeedbackAction>> allActions, String[] expectedUrls) {
int index = 0;
int totalSize = 0;
assertThat(allActions.size(), is(equalTo(2)));
for (List<FeedbackAction> actions : allActions) {
totalSize += actions.size();
for (FeedbackAction action : actions) {
assertUrlAction(action, ActionType.NARRATION, expectedUrls[index++]);
}
}
Assertions.assertThat(totalSize).isEqualTo(expectedUrls.length);
assertThat(totalSize, is(equalTo(expectedUrls.length)));
}
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:17,代码来源:FeedbackProcessingWithContainerIntegrationJUnitTest.java
示例2: should_download_file
import org.fest.assertions.api.Assertions; //导入依赖的package包/类
public void should_download_file() throws ListFolderErrorException, DbxException, FileNotFoundException, IOException, URISyntaxException {
// GIVEN
DropboxServiceImpl dboxSvc = assumeDroptboxRequirement();
String imageOriginPath = getTestImagePath();
File imageOrigin = new File(imageOriginPath);
// WHEN
String downloadTmpFile = dboxSvc.downloadFile("/essaiUpload/image.jpg");
// THEN
Assertions.assertThat(downloadTmpFile).isNotNull();
File tmpFile = new File(downloadTmpFile);
try {
boolean contentEquals = FileUtils.contentEquals(tmpFile, imageOrigin);
Assertions.assertThat(contentEquals).isTrue();
log.info("{} and (uploaded) tmp file {} are identicals", imageOriginPath, downloadTmpFile);
} finally {
tmpFile.setWritable(true);
tmpFile.delete();
}
}
示例3: compute_should_return_NoAnswer_if_present
import org.fest.assertions.api.Assertions; //导入依赖的package包/类
@Test
public void compute_should_return_NoAnswer_if_present() {
// Given
Response[] allResponses = new Response[]{
Response.NotApplicable,
Response.NoAnswer,
Response.OK,
Response.NotApplicable
};
// When
Response merged = Response.compute(allResponses);
// Then
Assertions.assertThat(merged).isEqualTo(Response.NoAnswer);
}
示例4: compile_With_Audit_Having_Anomalies
import org.fest.assertions.api.Assertions; //导入依赖的package包/类
@Test
public void compile_With_Audit_Having_Anomalies() throws Exception {
// Given
String expectedQuestionTitle = "Porte monnaie : contient des pennies";
AuditObject auditObject = buildAuditObjectWithAtLeastOneRuleHavingResponse(Response.NOK, expectedQuestionTitle);
audit.getObjects().add(auditObject);
// When
buildAndCompileAuditDocxExporter();
// Then
File document = new File(workingDirectory, "word/document.xml");
final String content = FileUtils.readFileToString(document, "UTF-8");
Assertions.assertThat(content).contains(auditObject.getName());
Assertions.assertThat(content).contains(expectedQuestionTitle);
}
示例5: compile_With_Audit_Comments
import org.fest.assertions.api.Assertions; //导入依赖的package包/类
@Test
public void compile_With_Audit_Comments() throws Exception {
// Given
File photo = new File("src/test/resources/photo/20140522165044.png");
Comment comment = new Comment();
comment.setType(Comment.Type.TEXT);
comment.setAudit(audit);
comment.setContent("content-audit-comment");
Comment commentPhoto = new Comment();
commentPhoto.setType(Comment.Type.PHOTO);
commentPhoto.setAttachment(photo.toURI().toString());
commentPhoto.setContent("content-audit-comment-photo");
audit.getComments().add(comment);
audit.getComments().add(commentPhoto);
// When
buildAndCompileAuditDocxExporter();
// Then
File document = new File(workingDirectory, "word/document.xml");
final String content = FileUtils.readFileToString(document, "UTF-8");
Assertions.assertThat(content).contains(comment.getContent());
}
示例6: compile_With_N_AuditObjects_Should_Generate_Path_With_Title_Containing_N
import org.fest.assertions.api.Assertions; //导入依赖的package包/类
@Test
public void compile_With_N_AuditObjects_Should_Generate_Path_With_Title_Containing_N() throws Exception {
// Given
for (int i = 0; i < 10; i++) {
audit.getObjects().add(buildAuditObjectWithObjectDescription(Response.OK, buildObjectDescription("A")));
}
// When
buildAndCompileAuditDocxExporter();
// Then
String content = FileUtils.readFileToString(new File(workingDirectory, "word/document.xml"), "UTF-8");
Assertions.assertThat(content).contains(String.format("%d elements audited", audit.getObjects().size()));
}
示例7: checkAuditPathColor
import org.fest.assertions.api.Assertions; //导入依赖的package包/类
private void checkAuditPathColor(Response response, String color) throws Exception {
// Given
AuditObject auditObject = buildAuditObjectWithAtLeastOneRuleHavingResponse(response, "", "", "", buildObjectDescription("A"));
audit.getObjects().add(auditObject);
// When
buildAndCompileAuditDocxExporter();
// Then
String content = FileUtils.readFileToString(new File(workingDirectory, "word/document.xml"), "UTF-8");
//Assertions.assertThat(content).contains(String.format("<w:shd w:val=\"clear\" w:color=\"auto\" w:fill=\"%s\"/>", color)); // OK
Assertions.assertThat(content).contains(String.format("<a:srgbClr val=\"%s\" />", color));
Assertions.assertThat(content).contains(String.format("r:embed=\"icon_777\">", auditObject.getId()));
content = FileUtils.readFileToString(new File(workingDirectory, "word/[_]rels/document.xml.rels"), "UTF-8");
Assertions.assertThat(content).contains(String.format("<Relationship Id=\"icon_%d\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\" Target=\"media/icon/A.png\"/>", auditObject.getId())); // OK
}
示例8: compile_With_AuditObject_Having_Anomaly_Should_Generate_Report_With_Anomaly
import org.fest.assertions.api.Assertions; //导入依赖的package包/类
@Test
public void compile_With_AuditObject_Having_Anomaly_Should_Generate_Report_With_Anomaly() throws Exception {
// Given
AuditObject auditObject = buildAuditObjectWithAtLeastOneRuleHavingResponse(Response.NOK, "question", "ruleId", "rule description", buildObjectDescription("A"));
audit.getObjects().add(auditObject);
// When
buildAndCompileAuditDocxExporter();
// Then
String content = FileUtils.readFileToString(new File(workingDirectory, "word/document.xml"), "UTF-8");
Assertions.assertThat(content).contains("ruleId");
Assertions.assertThat(content).contains("rule description");
Assertions.assertThat(content).contains("KO");
}
示例9: compile_With_AuditObject_Having_Doubt_Should_Generate_Report_With_Doubt
import org.fest.assertions.api.Assertions; //导入依赖的package包/类
@Test
public void compile_With_AuditObject_Having_Doubt_Should_Generate_Report_With_Doubt() throws Exception {
// Given
AuditObject auditObject = buildAuditObjectWithAtLeastOneRuleHavingResponse(Response.DOUBT, "question", "ruleId", "rule description", buildObjectDescription("A"));
audit.getObjects().add(auditObject);
// When
buildAndCompileAuditDocxExporter();
// Then
String content = FileUtils.readFileToString(new File(workingDirectory, "word/document.xml"), "UTF-8");
Assertions.assertThat(content).contains("ruleId");
Assertions.assertThat(content).contains("rule description");
Assertions.assertThat(content).contains("doute");
}
示例10: compile_With_AuditObject_Having_Text_Comment_Should_Generate_Report_With_Text_Comment
import org.fest.assertions.api.Assertions; //导入依赖的package包/类
@Test
public void compile_With_AuditObject_Having_Text_Comment_Should_Generate_Report_With_Text_Comment() throws Exception {
// Given
Comment comment = new Comment();
comment.setType(Comment.Type.TEXT);
comment.setContent("comment");
AuditObject auditObject = buildAuditObjectWithAtLeastOneRuleHavingResponse(Response.NOK, "");
auditObject.getComments().add(comment);
audit.getObjects().add(auditObject);
// When
buildAndCompileAuditDocxExporter();
// Then
String content = FileUtils.readFileToString(new File(workingDirectory, "word/document.xml"), "UTF-8");
Assertions.assertThat(content).contains(comment.getContent());
}
示例11: hasCacheKey
import org.fest.assertions.api.Assertions; //导入依赖的package包/类
public CacheEventAssert hasCacheKey(CacheKey expected) {
Assertions.assertThat(actual.getCacheKey())
.overridingErrorMessage(
"Cache event mismatch - cache key <%s> does not match <%s>",
actual.getCacheKey(),
expected)
.isEqualTo(expected);
return this;
}
示例12: hasException
import org.fest.assertions.api.Assertions; //导入依赖的package包/类
public CacheEventAssert hasException(IOException expected) {
Assertions.assertThat(actual.getException())
.overridingErrorMessage(
"Cache event mismatch - exception <%s> does not match <%s>",
actual.getCacheKey(),
expected)
.isEqualTo(expected);
return this;
}
示例13: hasEvictionReason
import org.fest.assertions.api.Assertions; //导入依赖的package包/类
public CacheEventAssert hasEvictionReason(CacheEventListener.EvictionReason expected) {
Assertions.assertThat(actual.getEvictionReason())
.overridingErrorMessage(
"Cache event mismatch - exception <%s> does not match <%s>",
actual.getEvictionReason(),
expected)
.isEqualTo(expected);
return this;
}
示例14: hasItemSize
import org.fest.assertions.api.Assertions; //导入依赖的package包/类
public CacheEventAssert hasItemSize(long expected) {
Assertions.assertThat(actual.getItemSize())
.overridingErrorMessage(
"Cache event mismatch - item size <%s> does not match <%s>",
actual.getItemSize(),
expected)
.isEqualTo(expected);
return this;
}
示例15: hasCacheSize
import org.fest.assertions.api.Assertions; //导入依赖的package包/类
public CacheEventAssert hasCacheSize(long expected) {
Assertions.assertThat(actual.getCacheSize())
.overridingErrorMessage(
"Cache event mismatch - cache size <%s> does not match <%s>",
actual.getCacheSize(),
expected)
.isEqualTo(expected);
return this;
}