@@ -39,8 +39,7 @@ public void deleteAllRecords() {
3939 @ Test
4040 public void givenAuthor_whenInsert_thenWeGetOneRecordInTheDatabase () {
4141 Author author = context .newObject (Author .class );
42- author .setFirstname ("Paul" );
43- author .setLastname ("Smith" );
42+ author .setName ("Paul" );
4443
4544 context .commitChanges ();
4645
@@ -51,28 +50,24 @@ public void givenAuthor_whenInsert_thenWeGetOneRecordInTheDatabase() {
5150 @ Test
5251 public void givenAuthor_whenInsert_andQueryByFirstName_thenWeGetTheAuthor () {
5352 Author author = context .newObject (Author .class );
54- author .setFirstname ("Paul" );
55- author .setLastname ("Smith" );
53+ author .setName ("Paul" );
5654
5755 context .commitChanges ();
5856
5957 Author expectedAuthor = ObjectSelect .query (Author .class )
60- .where (Author .FIRSTNAME .eq ("Paul" ))
58+ .where (Author .NAME .eq ("Paul" ))
6159 .selectOne (context );
6260
63- assertEquals ("Paul" , expectedAuthor .getFirstname ());
64- assertEquals ("Smith" , expectedAuthor .getLastname ());
61+ assertEquals ("Paul" , expectedAuthor .getName ());
6562 }
6663
6764 @ Test
6865 public void givenTwoAuthor_whenInsert_andQueryAll_thenWeGetTwoAuthors () {
6966 Author firstAuthor = context .newObject (Author .class );
70- firstAuthor .setFirstname ("Paul" );
71- firstAuthor .setLastname ("Smith" );
67+ firstAuthor .setName ("Paul" );
7268
7369 Author secondAuthor = context .newObject (Author .class );
74- secondAuthor .setFirstname ("Ludovic" );
75- secondAuthor .setLastname ("Garcia" );
70+ secondAuthor .setName ("Ludovic" );
7671
7772 context .commitChanges ();
7873
@@ -83,44 +78,40 @@ public void givenTwoAuthor_whenInsert_andQueryAll_thenWeGetTwoAuthors() {
8378 @ Test
8479 public void givenAuthor_whenUpdating_thenWeGetAnUpatedeAuthor () {
8580 Author author = context .newObject (Author .class );
86- author .setFirstname ("Paul" );
87- author .setLastname ("Smith" );
81+ author .setName ("Paul" );
8882 context .commitChanges ();
8983
9084 Author expectedAuthor = ObjectSelect .query (Author .class )
91- .where (Author .FIRSTNAME .eq ("Paul" ))
85+ .where (Author .NAME .eq ("Paul" ))
9286 .selectOne (context );
93- expectedAuthor .setLastname ( "Smith 2 " );
87+ expectedAuthor .setName ( "Garcia " );
9488 context .commitChanges ();
9589
96- assertEquals (author .getFirstname (), expectedAuthor .getFirstname ());
97- assertEquals (author .getLastname (), expectedAuthor .getLastname ());
90+ assertEquals (author .getName (), expectedAuthor .getName ());
9891 }
9992
10093 @ Test
10194 public void givenAuthor_whenDeleting_thenWeLostHisDetails () {
10295 Author author = context .newObject (Author .class );
103- author .setFirstname ("Paul" );
104- author .setLastname ("Smith" );
96+ author .setName ("Paul" );
10597 context .commitChanges ();
10698
10799 Author savedAuthor = ObjectSelect .query (Author .class )
108- .where (Author .FIRSTNAME .eq ("Paul" )).selectOne (context );
100+ .where (Author .NAME .eq ("Paul" )).selectOne (context );
109101 if (savedAuthor != null ) {
110102 context .deleteObjects (author );
111103 context .commitChanges ();
112104 }
113105
114106 Author expectedAuthor = ObjectSelect .query (Author .class )
115- .where (Author .FIRSTNAME .eq ("Paul" )).selectOne (context );
107+ .where (Author .NAME .eq ("Paul" )).selectOne (context );
116108 assertNull (expectedAuthor );
117109 }
118110
119111 @ Test
120112 public void givenAuthor_whenAttachingToArticle_thenTheRelationIsMade () {
121113 Author author = context .newObject (Author .class );
122- author .setFirstname ("Paul" );
123- author .setLastname ("Smith" );
114+ author .setName ("Paul" );
124115
125116 Article article = context .newObject (Article .class );
126117 article .setTitle ("My post title" );
@@ -130,7 +121,7 @@ public void givenAuthor_whenAttachingToArticle_thenTheRelationIsMade() {
130121 context .commitChanges ();
131122
132123 Author expectedAuthor = ObjectSelect .query (Author .class )
133- .where (Author .LASTNAME .eq ("Smith " ))
124+ .where (Author .NAME .eq ("Paul " ))
134125 .selectOne (context );
135126
136127 Article expectedArticle = (expectedAuthor .getArticles ()).get (0 );
0 commit comments