public final class ShouldExtensions extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ShouldExtensions.ShouldException
Major exception in a should function.
|
Modifier and Type | Method and Description |
---|---|
static <K,V> boolean |
shouldBe(map : Map<K,V>,
reference : Map<? super K,? super V>)
Ensure that the given map contains the elements.
|
static boolean |
shouldBe(actual : org.eclipse.xtext.xbase.XBooleanLiteral,
expected : Object)
Ensure that the given boolean literal is equal to the given value.
|
static boolean |
shouldBe(actual : org.eclipse.xtext.xbase.XCollectionLiteral,
expected : Object)
Ensure that the given type literal is equal to the given list.
|
static boolean |
shouldBe(actual : org.eclipse.xtext.xbase.XNumberLiteral,
expected : Object)
Ensure that the given number literal is equal to the given value.
|
static boolean |
shouldBe(actual : org.eclipse.xtext.xbase.XStringLiteral,
expected : Object)
Ensure that the given string literal is equal to the given value.
|
static boolean |
shouldBe(actual : org.eclipse.xtext.xbase.XTypeLiteral,
expected : Object)
Ensure that the given type literal is equal to the given type.
|
static boolean |
shouldBeApiURL(actual : String,
allowedAPIhostname : String)
Ensure that the string has the format of an URL to the SARL API.
|
static boolean |
shouldBeAtLeastJava(minVersion : String)
Ensure that the version of the current Java specification is at
least the one given by minVersion.
|
static boolean |
shouldBeDate(actual : String)
Ensure that the string has the format of a date.
|
static boolean |
shouldBeDate(actual : String,
dateFormat : String)
Ensure that the string has the format of a date.
|
static boolean |
shouldBeHiddenName(string : String)
Ensure that the given string is an hidden name according to the SARL specification.
|
static boolean |
shouldBeJavaRange(minVersion : String,
maxVersion : String)
Ensure that the version of the current Java specification is in
the range given by the minVersion (inclusive) and maxVersion (exclusive).
|
static boolean |
shouldBeLiteral(actual : org.eclipse.xtext.xbase.XExpression,
expected : Object)
Ensure that the given type literal is equal to the given type.
|
static boolean |
shouldBeMavenVersion(actual : String)
Ensure that the given string is a valid Maven version number, including snapshot.
|
static boolean |
shouldBeMavenVersion(actual : String,
allowSnapshot : boolean)
Ensure that the given string is a valid Maven version number.
|
static boolean |
shouldBeNumber(actual : String)
Ensure that the string has the format of a number.
|
static boolean |
shouldBeNumber(actual : String,
numberFormat : String)
Ensure that the string has the format of a number.
|
static boolean |
shouldExtend(type : Class<?>,
expectedTypes : String)
Ensure that the given type extends specific types.
|
static Field |
shouldHaveDeprecatedField(type : Class<?>,
name : String)
Ensure that the given type has the given type has the given deprecated field.
|
static Method |
shouldHaveDeprecatedMethod(type : Class<?>,
name : String)
Ensure that the given type has the given deprecated method.
|
static Field |
shouldHaveField(type : Class<?>,
name : String)
Ensure that the given type has the given type has the given field.
|
protected static Field |
shouldHaveField(type : Class<?>,
name : String,
deprecated : boolean)
Ensure that the given type has the given type has the given method.
|
static Method |
shouldHaveMethod(type : Class<?>,
name : String)
Ensure that the given type has the given method.
|
protected static Method |
shouldHaveMethod(type : Class<?>,
name : String,
deprecated : boolean)
Ensure that the given type has the given method.
|
static boolean |
shouldHaveMethods(type : Class<?>,
considerHiddenNames : boolean,
prototypes : String*)
Ensure that the given type has the given methods.
|
static boolean |
shouldHaveMethods(type : Class<?>,
prototypes : String*)
Ensure that the given type has the given methods.
|
static boolean |
shouldHaveNbMembers(type : Class<?>,
expectedNbOfElements : int)
Ensure that the given type has the number of members.
|
static boolean |
shouldHaveProperty(propertyFile : URL,
property : org.eclipse.xtext.xbase.lib.Pair<String,String>)
Ensure that the given URL is a property file with the given property.
|
static boolean |
shouldHaveProperty(propertyFile : URL,
propertyName : String)
Ensure that the given URL is a property file with the given property name.
|
static boolean |
shouldIterate(actual : Iterator<?>,
expected : Object)
Ensure that the iterator replies the expected values in the given order.
|
static boolean |
shouldIterate(actual : Iterator<?>,
expected : Object,
significantOrder : boolean)
Ensure that the iterator replies the expected values in the given order.
|
public static def
shouldBeDate(actual : String,
dateFormat : String) : boolean
ShouldExtensions
actual
- the string to parse.dateFormat
- the expected format of the date, as
described in SimpleDateFormat
. If null
, the
default date format is considered.public static def
shouldBeDate(actual : String) : boolean
ShouldExtensions
actual
- the string to parse.public static def
shouldBeNumber(actual : String,
numberFormat : String) : boolean
ShouldExtensions
actual
- the string to parse.numberFormat
- the expected format of the number, as
described in DecimalFormat
. If null
, the
default date format is considered.public static def
shouldBeNumber(actual : String) : boolean
ShouldExtensions
actual
- the string to parse.public static def
shouldBeMavenVersion(actual : String,
allowSnapshot : boolean) : boolean
ShouldExtensions
actual
- the string to test.allowSnapshot
- indicates if the -SNAPSHOT
postfix
is considered as valid.public static def
shouldBeMavenVersion(actual : String) : boolean
ShouldExtensions
actual
- the string to test.public static def
shouldBeJavaRange(minVersion : String,
maxVersion : String) : boolean
ShouldExtensions
minVersion
- the minimal version.maxVersion
- the maximal version.public static def
shouldBeAtLeastJava(minVersion : String) : boolean
ShouldExtensions
minVersion
- the minimal version.public static def
shouldIterate(actual : Iterator<?>,
expected : Object) : boolean
ShouldExtensions
actual
- the iterator to test.expected
- the expected values.public static def
shouldIterate(actual : Iterator<?>,
expected : Object,
significantOrder : boolean) : boolean
ShouldExtensions
actual
- the iterator to test.expected
- the expected values.significantOrder
- indicates if the order of the elements is significant.public static def
shouldBeApiURL(actual : String,
allowedAPIhostname : String) : boolean
ShouldExtensions
actual
- the string to parse.allowedAPIhostname
- is a list of API base hostname to consider as valid.
If not given, only "www.sarl.io" is allowed.public static def
shouldBe(actual : org.eclipse.xtext.xbase.XStringLiteral,
expected : Object) : boolean
ShouldExtensions
actual
- the string literal to test.expected
- the expected value.public static def
shouldBe(actual : org.eclipse.xtext.xbase.XBooleanLiteral,
expected : Object) : boolean
ShouldExtensions
actual
- the boolean literal to test.expected
- the expected value.public static def
shouldBe(actual : org.eclipse.xtext.xbase.XNumberLiteral,
expected : Object) : boolean
ShouldExtensions
actual
- the number literal to test.expected
- the expected value.public static def
shouldBe(actual : org.eclipse.xtext.xbase.XTypeLiteral,
expected : Object) : boolean
ShouldExtensions
actual
- the type literal to test.expected
- the name of the expected type.public static def
shouldBe(actual : org.eclipse.xtext.xbase.XCollectionLiteral,
expected : Object) : boolean
ShouldExtensions
actual
- the type literal to test.expected
- the name of the expected type.public static def
shouldBeLiteral(actual : org.eclipse.xtext.xbase.XExpression,
expected : Object) : boolean
ShouldExtensions
actual
- the type literal to test.expected
- the name of the expected type.public static def
shouldHaveDeprecatedMethod(type : Class<?>,
name : String) : Method
ShouldExtensions
type
- the type to check.name
- the name and prototype, e.g. fct(java.lang.String):int
.public static def
shouldHaveMethod(type : Class<?>,
name : String) : Method
ShouldExtensions
type
- the type to check.name
- the name and prototype, e.g. fct(java.lang.String):int
.protected static def
shouldHaveMethod(type : Class<?>,
name : String,
deprecated : boolean) : Method
ShouldExtensions
type
- the type to check.name
- the name and prototype, e.g. fct(java.lang.String):int
.deprecated
- indicates if the field must be deprecated.public static def
shouldHaveMethods(type : Class<?>,
prototypes : String*) : boolean
ShouldExtensions
type
- the type to check.prototypes
- the prototypes, e.g. fct(java.lang.String):int
.public static def
shouldHaveMethods(type : Class<?>,
considerHiddenNames : boolean,
prototypes : String*) : boolean
ShouldExtensions
type
- the type to check.considerHiddenNames
- indicates if the methods with hidden names are considered.prototypes
- the prototypes, e.g. fct(java.lang.String):int
.public static def
shouldBeHiddenName(string : String) : boolean
ShouldExtensions
string
- the text to validate.true
if the given string is an hidden name.public static def
shouldHaveDeprecatedField(type : Class<?>,
name : String) : Field
ShouldExtensions
type
- the type to check.name
- the name and prototype, e.g. x:int
.public static def
shouldHaveField(type : Class<?>,
name : String) : Field
ShouldExtensions
type
- the type to check.name
- the name and prototype, e.g. x:int
.protected static def
shouldHaveField(type : Class<?>,
name : String,
deprecated : boolean) : Field
ShouldExtensions
type
- the type to check.name
- the name and prototype, e.g. x:int
.deprecated
- indicates if the field must be deprecated.public static def
shouldExtend(type : Class<?>,
expectedTypes : String) : boolean
ShouldExtensions
type
- the type to check.expectedTypes
- the qualified names of the expected types, separated by comas.public static def
shouldHaveNbMembers(type : Class<?>,
expectedNbOfElements : int) : boolean
ShouldExtensions
type
- the type to check.expectedNbOfElements
- the expected number of elements.public staticdef
shouldBe(map : Map<K,V>, reference : Map<? super K,? super V>) : booleanwith
<K,V>
ShouldExtensions
K
- type of the keys.V
- type of the values.map
- the map to check.reference
- the expected elements in the map.public static def
shouldHaveProperty(propertyFile : URL,
propertyName : String) : boolean
ShouldExtensions
propertyFile
- the name of the property file.propertyName
- the name of the property name.public static def
shouldHaveProperty(propertyFile : URL,
property : org.eclipse.xtext.xbase.lib.Pair<String,String>) : boolean
ShouldExtensions
propertyFile
- the name of the property file.property
- the property.Copyright © 2021 the original authors or authors.