public class Template extends Object
File or an URL.
Template content example for hasXXX property assertion :
public ${custom_assertion_class} has${Property}(${propertyType} ${property}) {
// check that actual ${class_to_assert} we want to make assertions on is not null.
isNotNull();
// we overrides the default error message with a more explicit one
String assertjErrorMessage = format("Expected ${class_to_assert}'s ${property} to be <%s> but was <%s>", ${property}, actual.get${Property}());
// check
if (!actual.get${Property}().equals(${property})) { throw new AssertionError(assertjErrorMessage); }
// return the current assertion for method chaining
return this;
}
| Modifier and Type | Class and Description |
|---|---|
static class |
Template.Type |
| Constructor and Description |
|---|
Template(Template.Type type,
File file)
|
Template(Template.Type type,
String templateContent)
Creates a new
Template from the given content. |
Template(Template.Type type,
URL url)
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
String |
getContent() |
Template.Type |
getType() |
int |
hashCode() |
public Template(Template.Type type, String templateContent)
Template from the given content.templateContent - the template contentpublic Template(Template.Type type, URL url)
url - the URL to read to set the content of the TemplateRuntimeException - if we fail to read the URL contentpublic Template(Template.Type type, File file)
file - the File to read to set the content of the TemplateRuntimeException - if we fail to read the File contentCopyright © 2017 AssertJ. All rights reserved.