diff --git a/.idea/runConfigurations/tests_in_validation_test_dart.xml b/.idea/runConfigurations/tests_in_validation_test_dart.xml
new file mode 100644
index 00000000..863374eb
--- /dev/null
+++ b/.idea/runConfigurations/tests_in_validation_test_dart.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/graphql_schema/test/validation_test.dart b/graphql_schema/test/validation_test.dart
new file mode 100644
index 00000000..3645f7de
--- /dev/null
+++ b/graphql_schema/test/validation_test.dart
@@ -0,0 +1,32 @@
+import 'package:graphql_schema/graphql_schema.dart';
+import 'package:test/test.dart';
+
+void main() {
+ var pokemonType = objectType('Pokémon', fields: [
+ field('name', type: graphQLString.nonNullable()),
+ ]);
+
+ var isValidPokemon = predicate(
+ (x) =>
+ pokemonType.validate('@root', x as Map).successful,
+ 'is a valid Pokémon');
+
+ var throwsATypeError =
+ throwsA(predicate((x) => x is TypeError, 'is a type error'));
+
+ test('mismatched scalar type', () {
+ expect(() => pokemonType.validate('@root', {'name': 24}), throwsATypeError);
+ });
+
+ test('empty passed for non-nullable', () {
+ expect({}, isNot(isValidPokemon));
+ });
+
+ test('null passed for non-nullable', () {
+ expect({'name': null}, isNot(isValidPokemon));
+ });
+
+ test('rejects extraneous fields', () {
+ expect({'name': 'Vulpix', 'foo': 'bar'}, isNot(isValidPokemon));
+ });
+}
diff --git a/graphql_server/test/common.dart b/graphql_server/test/common.dart
new file mode 100644
index 00000000..9be47053
--- /dev/null
+++ b/graphql_server/test/common.dart
@@ -0,0 +1,5 @@
+import 'package:graphql_schema/graphql_schema.dart';
+import 'package:test/test.dart';
+
+final Matcher throwsAGraphQLException =
+ throwsA(predicate((x) => x is GraphQLException, 'is a GraphQL exception'));