@@ -77,8 +77,8 @@ public void setup() {
7777 testoOrgAdress .setLines (
7878 new String [] {"Insee" , null , null , "88 AVE VERDIER" , null , null , null });
7979
80- Group utilisateursApplitest = new Group ("Applitest " , "Utilisateurs_Applitest " );
81- Group adminApplitest = new Group ("Applitest " , "Administrateurs_Applitest " );
80+ Group utilisateursApplitest = new Group ("Utilisateurs_Applitest " , "Applitest " );
81+ Group adminApplitest = new Group ("Administrateurs_Applitest " , "Applitest " );
8282 adminApplitest .setDescription ("toto" );
8383 User simpleTestcUser = new User ();
8484 simpleTestcUser .setUsername ("testc" );
@@ -254,33 +254,28 @@ public void testDeleteUser() {
254254 fileReaderStore .getGroup ("Applitest" , "Utilisateurs_Applitest" ).get ().getUsers ().stream ()
255255 .anyMatch (user -> user .getUsername ().equalsIgnoreCase ("byebye" )));
256256 assertThat (
257- "byebye is in Utilisateurs_Applitest " ,
257+ "byebye is in Utilisateurs " ,
258258 fileReaderStore .getUsersInGroup ("Applitest" , "Utilisateurs_Applitest" ).getResults ().stream ()
259259 .anyMatch (user -> user .getUsername ().equalsIgnoreCase ("byebye" )));
260260 fileWriterStore .deleteUser ("byebye" , null );
261261 assertThat ("byebye should have been deleted" , fileReaderStore .getUser ("byebye" ).isEmpty ());
262262 assertThat (
263- "byebye should no more be in Utilisateurs_Applitest " ,
264- ! fileReaderStore .getGroup ("Applitest" , "Utilisateurs_Applitest" ).get ().getUsers ().stream ()
265- .anyMatch (user -> user .getUsername ().equalsIgnoreCase ("byebye" )));
263+ "byebye should no more be in Utilisateurs " ,
264+ fileReaderStore .getGroup ("Applitest" , "Utilisateurs_Applitest" ).get ().getUsers ().stream ()
265+ .noneMatch (user -> user .getUsername ().equalsIgnoreCase ("byebye" )));
266266 assertThat (
267- "byebye is in Utilisateurs_Applitest" ,
268- !fileReaderStore
269- .getUsersInGroup ("Applitest" , "Utilisateurs_Applitest" )
270- .getResults ()
271- .stream ()
272- .anyMatch (user -> user .getUsername ().equalsIgnoreCase ("byebye" )));
267+ "byebye is in Utilisateurs" ,
268+ fileReaderStore .getUsersInGroup ("Applitest" , "Utilisateurs_Applitest" ).getResults ().stream ()
269+ .noneMatch (user -> user .getUsername ().equalsIgnoreCase ("byebye" )));
273270 }
274271
275272 @ Test
276273 public void testCreateApplication () {
277274 Application application = new Application ();
278275 application .setName ("MyApplication" );
279276 List <Group > groups = new ArrayList <>();
280- Group group1 = new Group ();
281- group1 .setName ("Group1_MyApplication" );
282- Group group2 = new Group ();
283- group2 .setName ("Group2_MyApplication" );
277+ Group group1 = new Group ("Group1_MyApplication" , "MyApplication" );
278+ Group group2 = new Group ("Group2_MyApplication" , "MyApplication" );
284279 group2 .setUsers (List .of (new User ("toto" )));
285280 groups .add (group1 );
286281 groups .add (group2 );
@@ -300,8 +295,7 @@ public void testCreateApplication() {
300295 @ Test
301296 public void testUpdateApplication () {
302297 Application application = fileReaderStore .getApplication ("Applitest" ).get ();
303- Group group1 = new Group ();
304- group1 .setName ("Group1_Applitest" );
298+ Group group1 = new Group ("Group1_Applitest" , "Applitest" );
305299 application .getGroups ().add (group1 );
306300 application .getGroups ().get (0 ).setDescription ("new description" );
307301 application .getGroups ().stream ()
@@ -322,8 +316,8 @@ public void testUpdateApplication() {
322316 .anyMatch (group -> group .getDescription ().equals ("new description" )));
323317 assertThat (
324318 "Users should not have been modified" ,
325- ! retrievedApplication .getGroups ().stream ()
326- .anyMatch (
319+ retrievedApplication .getGroups ().stream ()
320+ .noneMatch (
327321 group ->
328322 group .getName ().equals ("Utilisateurs_Applitest" )
329323 && group .getUsers ().size () != 3 ));
@@ -334,8 +328,8 @@ public void testDeleteApplication() {
334328 Application application = new Application ();
335329 application .setName ("NotEmptyApplication" );
336330 List <Group > groups = new ArrayList <>();
337- Group group1 = new Group ();
338- group1 . setName ( "Group1_NotEmptyApplication" );
331+ Group group1 = new Group ("Group1_NotEmptyApplication" , "NotEmptyApplication" );
332+ groups . add ( group1 );
339333 application .setGroups (groups );
340334 fileWriterStore .createApplication (application , null );
341335 assertThat (
@@ -350,8 +344,7 @@ public void testDeleteApplication() {
350344
351345 @ Test
352346 public void testCreateGroup () {
353- Group group = new Group ();
354- group .setName ("Groupy_Applitest" );
347+ Group group = new Group ("Groupy_Applitest" , "Applitest" );
355348 group .setDescription ("Super groupy de test" );
356349 User user = new User ();
357350 user .setUsername ("usery" );
@@ -367,13 +360,12 @@ public void testCreateGroup() {
367360
368361 @ Test
369362 public void testDeleteGroup () {
370- Group group = new Group ();
371- group .setName ("Asupprimer_WebServicesLdap" );
363+ Group group = new Group ("Asupprimer_WebServicesLdap" , "WebServicesLdap" );
372364 group .setDescription ("supprime ce groupe" );
373365 fileWriterStore .createGroup ("WebServicesLdap" , group , null );
374366 fileWriterStore .deleteGroup ("WebServicesLdap" , "Asupprimer_WebServicesLdap" , null );
375367 assertThat (
376- "Should have been deleted" ,
368+ "Asupprimer Should have been deleted" ,
377369 fileReaderStore .getGroup ("WebServicesLdap" , "Asupprimer_WebServicesLdap" ).isEmpty ());
378370 }
379371
0 commit comments