Skip to content

Package: DeleteOperationsWithInheritanceRunner

DeleteOperationsWithInheritanceRunner

nameinstructionbranchcomplexitylinemethod
DeleteOperationsWithInheritanceRunner(Logger)
M: 0 C: 4
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
testRemoveEntityWithEntitySuperclass()
M: 0 C: 70
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 12
100%
M: 0 C: 1
100%
testRemoveEntityWithMappedSuperclass()
M: 0 C: 65
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 11
100%
M: 0 C: 1
100%

Coverage

1: /**
2: * Copyright (C) 2016 Czech Technical University in Prague
3: *
4: * This program is free software: you can redistribute it and/or modify it under
5: * the terms of the GNU General Public License as published by the Free Software
6: * Foundation, either version 3 of the License, or (at your option) any
7: * later version.
8: *
9: * This program is distributed in the hope that it will be useful, but WITHOUT
10: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11: * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12: * details. You should have received a copy of the GNU General Public License
13: * along with this program. If not, see <http://www.gnu.org/licenses/>.
14: */
15: package cz.cvut.kbss.jopa.test.runner;
16:
17: import cz.cvut.kbss.jopa.test.OWLClassA;
18: import cz.cvut.kbss.jopa.test.OWLClassQ;
19: import cz.cvut.kbss.jopa.test.OWLClassT;
20: import org.junit.Test;
21: import org.slf4j.Logger;
22:
23: import static org.junit.Assert.*;
24:
25: public abstract class DeleteOperationsWithInheritanceRunner extends BaseInheritanceRunner {
26:
27: public DeleteOperationsWithInheritanceRunner(Logger logger) {
28: super(logger);
29: }
30:
31: @Test
32: public void testRemoveEntityWithMappedSuperclass() {
33: this.em = getEntityManager("RemoveEntityWithMappedSuperclass", false);
34: persist(entityQ, entityA);
35:
36: em.getTransaction().begin();
37: final OWLClassQ toRemove = em.find(OWLClassQ.class, entityQ.getUri());
38: assertNotNull(toRemove);
39: em.remove(toRemove);
40: em.getTransaction().commit();
41:
42: assertNull(em.find(OWLClassQ.class, entityQ.getUri()));
43: assertNotNull(em.find(OWLClassA.class, entityA.getUri()));
44: verifyIndividualWasRemoved(entityQ.getUri());
45: }
46:
47: @Test
48: public void testRemoveEntityWithEntitySuperclass() {
49: this.em = getEntityManager("RemoveEntityWithEntitySuperclass", false);
50: persist(entityT, entityA);
51:
52: em.getTransaction().begin();
53: final OWLClassT toRemove = em.find(OWLClassT.class, entityT.getUri());
54: assertNotNull(toRemove);
55: em.remove(toRemove);
56: assertFalse(em.contains(toRemove));
57: em.getTransaction().commit();
58:
59: assertNull(em.find(OWLClassT.class, entityT.getUri()));
60: assertNotNull(em.find(OWLClassA.class, entityA.getUri()));
61: verifyIndividualWasRemoved(entityT.getUri());
62: }
63: }