Addressing comments

pull/5/head
Andrew Brogdon 8 years ago
parent f00aaf41ae
commit 25bbb5f96c

@ -104,7 +104,7 @@ class BasicsPage extends StatelessWidget {
children: [
Padding(
padding: const EdgeInsets.only(right: 8.0, bottom: 4.0),
child: Text('List of dynamic:', style: boldStyle),
child: Text('List of dynamics:', style: boldStyle),
),
Text(
prettyPrintList(strongListOfDynamics),

@ -9,7 +9,7 @@ import 'package:jsonexample/dart_convert/converted_complex_object.dart';
import 'package:jsonexample/json_serializable/serializable_complex_object.dart';
void main() {
const Map<String, dynamic> typicalObjectJson = {
const typicalObjectJson = <String, dynamic>{
'aString': 'Blah, blah, blah.',
'anInt': 1,
'aDouble': 1.0,
@ -52,7 +52,7 @@ void main() {
]
};
Map<String, dynamic> emptySimpleObjectsJson = {
const emptySimpleObjectsJson = <String, dynamic>{
'aString': 'Blah, blah, blah.',
'anInt': 1,
'aDouble': 1.0,
@ -67,7 +67,7 @@ void main() {
]
};
const Map<String, dynamic> unexpectedPropertiesJson = {
const unexpectedPropertiesJson = <String, dynamic>{
'aString': 'Blah, blah, blah.',
'anInt': 1,
'aDouble': 1.0,
@ -115,8 +115,10 @@ void main() {
]
};
const emptyJson = <String, dynamic>{};
group('ConvertedComplexObject unit tests', () {
test('Typical object', () {
test('Typical object is converted correctly', () {
final complexObject = ConvertedComplexObject.fromJson(typicalObjectJson);
expect(complexObject.aString, "Blah, blah, blah.");
@ -144,9 +146,8 @@ void main() {
}
});
test('Empty object', () {
final complexObject =
ConvertedComplexObject.fromJson(<String, dynamic>{});
test('Empty object results in null fields', () {
final complexObject = ConvertedComplexObject.fromJson(emptyJson);
expect(complexObject.aString, isNull);
expect(complexObject.anInt, isNull);
@ -158,7 +159,7 @@ void main() {
expect(complexObject.aListOfObjects, isNull);
});
test('Empty simple objects', () {
test('Empty simple objects result in instances with null fields', () {
final complexObject =
ConvertedComplexObject.fromJson(emptySimpleObjectsJson);
@ -186,7 +187,7 @@ void main() {
}
});
test('Extra properties', () {
test('Unexpected properties are ignored', () {
final complexObject =
ConvertedComplexObject.fromJson(unexpectedPropertiesJson);
@ -217,7 +218,7 @@ void main() {
});
group('SerializableComplexObject unit tests', () {
test('Typical object', () {
test('Typical object is converted correctly', () {
final complexObject =
SerializableComplexObject.fromJson(typicalObjectJson);
@ -246,9 +247,8 @@ void main() {
}
});
test('Empty object', () {
final complexObject =
SerializableComplexObject.fromJson(<String, dynamic>{});
test('Empty object results in null fields', () {
final complexObject = SerializableComplexObject.fromJson(emptyJson);
expect(complexObject.aString, isNull);
expect(complexObject.anInt, isNull);
@ -260,7 +260,7 @@ void main() {
expect(complexObject.aListOfObjects, isNull);
});
test('Empty simple objects', () {
test('Empty simple objects result in instances with null fields', () {
final complexObject =
SerializableComplexObject.fromJson(emptySimpleObjectsJson);
@ -288,7 +288,7 @@ void main() {
}
});
test('Extra properties', () {
test('Unexpected properties are ignored', () {
final complexObject =
SerializableComplexObject.fromJson(unexpectedPropertiesJson);
@ -319,7 +319,7 @@ void main() {
});
group('BuiltComplexObject unit tests', () {
test('Typical object', () {
test('Typical object is converted correctly', () {
final complexObject = serializers.deserializeWith(
BuiltComplexObject.serializer, typicalObjectJson);
@ -348,9 +348,9 @@ void main() {
}
});
test('Empty object', () {
final complexObject = serializers
.deserializeWith(BuiltComplexObject.serializer, <String, dynamic>{});
test('Empty object results in null fields', () {
final complexObject =
serializers.deserializeWith(BuiltComplexObject.serializer, emptyJson);
expect(complexObject.aString, isNull);
expect(complexObject.anInt, isNull);
@ -362,7 +362,7 @@ void main() {
expect(complexObject.aListOfObjects, isNull);
});
test('Empty simple objects', () {
test('Empty simple objects result in instances with null fields', () {
final complexObject = serializers.deserializeWith(
BuiltComplexObject.serializer, emptySimpleObjectsJson);
@ -390,7 +390,7 @@ void main() {
}
});
test('Extra properties', () {
test('Unexpected properties are ignored', () {
final complexObject = serializers.deserializeWith(
BuiltComplexObject.serializer, unexpectedPropertiesJson);

@ -9,7 +9,7 @@ import 'package:jsonexample/dart_convert/converted_simple_object.dart';
import 'package:jsonexample/json_serializable/serializable_simple_object.dart';
void main() {
const Map<String, dynamic> typicalObjectJson = {
const typicalObjectJson = <String, dynamic>{
'aString': 'Blah, blah, blah.',
'anInt': 1,
'aDouble': 1.0,
@ -18,7 +18,7 @@ void main() {
'aListOfDoubles': [1.0, 2.0, 3.0]
};
const Map<String, dynamic> emptyListJson = {
const emptyListJson = <String, dynamic>{
'aString': 'Blah, blah, blah.',
'anInt': 1,
'aDouble': 1.0,
@ -27,7 +27,7 @@ void main() {
'aListOfDoubles': []
};
const Map<String, dynamic> unexpectedPropertyjson = {
const unexpectedPropertiesJson = <String, dynamic>{
'aString': 'Blah, blah, blah.',
'anInt': 1,
'aDouble': 1.0,
@ -37,8 +37,10 @@ void main() {
'unexpectedProperty': 'Whoops!'
};
const emptyJson = <String, dynamic>{};
group('ConvertedSimpleObject unit tests', () {
test('Typical object', () {
test('Typical object is converted correctly', () {
final simpleObject = ConvertedSimpleObject.fromJson(typicalObjectJson);
expect(simpleObject, isNotNull);
@ -51,7 +53,7 @@ void main() {
});
test('Empty object', () {
final simpleObject = ConvertedSimpleObject.fromJson(<String, dynamic>{});
final simpleObject = ConvertedSimpleObject.fromJson(emptyJson);
expect(simpleObject, isNotNull);
expect(simpleObject.aString, isNull);
@ -76,7 +78,7 @@ void main() {
test('Extra properties', () {
final simpleObject =
ConvertedSimpleObject.fromJson(unexpectedPropertyjson);
ConvertedSimpleObject.fromJson(unexpectedPropertiesJson);
expect(simpleObject, isNotNull);
expect(simpleObject.aString, "Blah, blah, blah.");
@ -89,7 +91,7 @@ void main() {
});
group('SerializableSimpleObject unit tests', () {
test('Typical object', () {
test('Typical object is converted correctly', () {
final simpleObject = SerializableSimpleObject.fromJson(typicalObjectJson);
expect(simpleObject, isNotNull);
@ -101,9 +103,8 @@ void main() {
expect(simpleObject.aListOfDoubles, [1.0, 2.0, 3.0]);
});
test('Empty object', () {
final simpleObject =
SerializableSimpleObject.fromJson(<String, dynamic>{});
test('Empty object results in null fields', () {
final simpleObject = SerializableSimpleObject.fromJson(emptyJson);
expect(simpleObject, isNotNull);
expect(simpleObject.aString, isNull);
@ -114,7 +115,7 @@ void main() {
expect(simpleObject.aListOfDoubles, isNull);
});
test('Empty lists', () {
test('Empty lists are converted as empty lists', () {
final simpleObject = SerializableSimpleObject.fromJson(emptyListJson);
expect(simpleObject, isNotNull);
@ -126,9 +127,9 @@ void main() {
expect(simpleObject.aListOfDoubles, []);
});
test('Extra properties', () {
test('Unexpected properties are ignored', () {
final simpleObject =
SerializableSimpleObject.fromJson(unexpectedPropertyjson);
SerializableSimpleObject.fromJson(unexpectedPropertiesJson);
expect(simpleObject, isNotNull);
expect(simpleObject.aString, "Blah, blah, blah.");
@ -141,7 +142,7 @@ void main() {
});
group('BuiltSimpleObject unit tests', () {
test('Typical object', () {
test('Typical object is converted correctly', () {
final simpleObject = serializers.deserializeWith(
BuiltSimpleObject.serializer, typicalObjectJson);
@ -154,9 +155,9 @@ void main() {
expect(simpleObject.aListOfDoubles, [1.0, 2.0, 3.0]);
});
test('Empty object', () {
final simpleObject = serializers
.deserializeWith(BuiltSimpleObject.serializer, <String, dynamic>{});
test('Empty object results in null fields', () {
final simpleObject =
serializers.deserializeWith(BuiltSimpleObject.serializer, emptyJson);
expect(simpleObject, isNotNull);
expect(simpleObject.aString, isNull);
@ -167,7 +168,7 @@ void main() {
expect(simpleObject.aListOfDoubles, isNull);
});
test('Empty lists', () {
test('Empty lists are converted as empty lists', () {
final simpleObject = serializers.deserializeWith(
BuiltSimpleObject.serializer, emptyListJson);
@ -180,9 +181,9 @@ void main() {
expect(simpleObject.aListOfDoubles, []);
});
test('Extra properties', () {
test('Unexpected properties are ignored', () {
final simpleObject = serializers.deserializeWith(
BuiltSimpleObject.serializer, unexpectedPropertyjson);
BuiltSimpleObject.serializer, unexpectedPropertiesJson);
expect(simpleObject, isNotNull);
expect(simpleObject.aString, "Blah, blah, blah.");

@ -10,7 +10,8 @@ import 'package:jsonexample/widgets.dart';
void main() {
group('SimpleObjectView widget test', () {
testWidgets('Typical object', (WidgetTester tester) async {
testWidgets('Typical object is displayed correctly',
(WidgetTester tester) async {
final simpleObject = ConvertedSimpleObject(
aString: 'Blah, blah, blah',
anInt: 1,
@ -34,7 +35,8 @@ void main() {
expect(find.text('[1.0, 2.0, 3.0]'), findsOneWidget);
});
testWidgets('Empty lists', (WidgetTester tester) async {
testWidgets('Empty lists are displayed as brackets',
(WidgetTester tester) async {
final simpleObject = ConvertedSimpleObject(
aString: 'Blah, blah, blah',
anInt: 1,
@ -53,7 +55,8 @@ void main() {
expect(find.text('[]'), findsNWidgets(3));
});
testWidgets('Null values', (WidgetTester tester) async {
testWidgets('Null values are displayed as NULL',
(WidgetTester tester) async {
final simpleObject = ConvertedSimpleObject(
aString: null,
anInt: null,
@ -74,7 +77,8 @@ void main() {
});
group('ComplexObjectView widget test', () {
testWidgets('Typical object', (WidgetTester tester) async {
testWidgets('Typical object is displayed correctly',
(WidgetTester tester) async {
final complexObject = ConvertedComplexObject(
aString: 'Blah, blah, blah',
anInt: 1,
@ -141,7 +145,8 @@ void main() {
}
});
testWidgets('Empty Lists', (WidgetTester tester) async {
testWidgets('Empty lists are displayed as brackets',
(WidgetTester tester) async {
final complexObject = ConvertedComplexObject(
aString: 'Blah, blah, blah',
anInt: 1,
@ -169,7 +174,8 @@ void main() {
expect(find.text('[]'), findsNWidgets(4));
});
testWidgets('Null values', (WidgetTester tester) async {
testWidgets('Null values are displayed as NULL',
(WidgetTester tester) async {
final complexObject = ConvertedComplexObject(
aString: null,
anInt: null,

Loading…
Cancel
Save