Permalink
Browse files
doc: Added sample for testing
- Loading branch information...
Showing
with
18 additions
and
7 deletions.
-
+2
−1
Validate.iml
-
+16
−6
lib/validate.dart
|
@@ -3,6 +3,7 @@ |
|
|
|
<component name="NewModuleRootManager" inherit-compiler-output="true"> |
|
|
|
<exclude-output /> |
|
|
|
<content url="file://$MODULE_DIR$"> |
|
|
|
<excludeFolder url="" /> |
|
|
|
<excludeFolder url="file://$MODULE_DIR$/.pub" /> |
|
|
|
<excludeFolder url="file://$MODULE_DIR$/build" /> |
|
|
|
<excludeFolder url="file://$MODULE_DIR$/packages" /> |
|
@@ -11,7 +12,7 @@ |
|
|
|
<excludeFolder url="file://$MODULE_DIR$/tool/packages" /> |
|
|
|
</content> |
|
|
|
<orderEntry type="sourceFolder" forTests="false" /> |
|
|
|
<orderEntry type="library" name="Dart SDK" level="application" /> |
|
|
|
<orderEntry type="library" name="Dart SDK" level="project" /> |
|
|
|
<orderEntry type="library" name="Dart Packages" level="project" /> |
|
|
|
</component> |
|
|
|
<component name="org.twodividedbyzero.idea.findbugs"> |
|
|
|
@@ -25,14 +25,24 @@ part "src/errors.dart"; |
|
|
|
part "src/utils.dart"; |
|
|
|
|
|
|
|
/** |
|
|
|
* <p>This class assists in validating arguments. The validation methods are |
|
|
|
* This class assists in validating arguments. The validation methods are |
|
|
|
* based along the following principles: |
|
|
|
* For example:</p> |
|
|
|
* |
|
|
|
* <pre> |
|
|
|
* Validate.isTrue(i > 0, "The value must be greater than zero"); |
|
|
|
* Validate.notNull(surname, "The surname must not be null"); |
|
|
|
* </pre> |
|
|
|
* Validate.isTrue(i > 0, "The value must be greater than zero"); |
|
|
|
* Validate.notNull(surname, "The surname must not be null"); |
|
|
|
* |
|
|
|
* For testing - use it like this: |
|
|
|
* class UserContext { |
|
|
|
* final String _restID; |
|
|
|
* UserContext(this._restID) { |
|
|
|
* Validate.isUUID(_restID); |
|
|
|
* } |
|
|
|
* } |
|
|
|
* test('> wrong ID ', () { |
|
|
|
* expect(() => new UserContext("abc"), |
|
|
|
* throwsArgumentError); |
|
|
|
* }); // end of 'wrong ID ' test |
|
|
|
* |
|
|
|
*/ |
|
|
|
|
|
|
|
/** |
|
|
0 comments on commit
158f512