Project

General

Profile

« Previous | Next » 

Revision 72aa4212

Added by Cherian Mathew about 9 years ago

added h2 db to resources and delete test to test class

View differences:

eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/cdm/polytomouskey/PolytomousKeyTest.java
324 324
        polytomousKeyService.delete(subKey);
325 325

  
326 326
        // since subKey was not initialized before the delete, an attempt
327
        // to initialize it after will lead to an npe
327
        // to initialize it after will lead to an NPE
328 328
        try {
329 329
            PolytomousKeyNode subKeyRootNode = subKey.getRoot();
330 330
            Assert.fail("A NullPointerException indicating null root node should be thrown here");
331 331
        } catch(NullPointerException npe) {
332 332

  
333 333
        }
334

  
334
        // retrieving subkey shows its null
335 335
        subKey = CdmBase.deproxy(polytomousKeyService.find(subKeyUuid),PolytomousKey.class);
336 336
        Assert.assertNull(subKey);
337 337

  
......
341 341
        rootNode = pKey.getRoot();
342 342
        child = rootNode.getChildAt(0);
343 343
        subKey = child.getSubkey();
344

  
344
        // subkey will not be null, because the delete functionality of the subkey
345
        // does not currently delete it from a polytomous key node
346
        Assert.assertNotNull(subKey);
345 347
        // after reloading the object graph, accessing subKey should throw a null pointer exception
346 348
        try {
347 349
            PolytomousKeyNode subKeyRootNode = subKey.getRoot();
......
359 361

  
360 362
        PolytomousKeyNode rootNode = pKey.getRoot();
361 363
        PolytomousKeyNode child = rootNode.getChildAt(0);
362
        polytomousKeyNodeService.delete(child);
364
        polytomousKeyNodeService.delete(child, true, true);
363 365
    }
364 366

  
365 367
    @Test

Also available in: Unified diff