Skip to content

Package: DeleteOperationsWithInheritanceRunner

DeleteOperationsWithInheritanceRunner

nameinstructionbranchcomplexitylinemethod
DeleteOperationsWithInheritanceRunner(Logger, PersistenceFactory, DataAccessor)
M: 0 C: 6
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) 2020 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 cz.cvut.kbss.jopa.test.environment.DataAccessor;
21: import cz.cvut.kbss.jopa.test.environment.PersistenceFactory;
22: import org.junit.jupiter.api.Test;
23: import org.slf4j.Logger;
24:
25: import static org.junit.jupiter.api.Assertions.*;
26:
27: public abstract class DeleteOperationsWithInheritanceRunner extends BaseInheritanceRunner {
28:
29: public DeleteOperationsWithInheritanceRunner(Logger logger, PersistenceFactory persistenceFactory,
30: DataAccessor dataAccessor) {
31: super(logger, persistenceFactory, dataAccessor);
32: }
33:
34: @Test
35: public void testRemoveEntityWithMappedSuperclass() {
36: this.em = getEntityManager("RemoveEntityWithMappedSuperclass", false);
37: persist(entityQ, entityA);
38:
39: em.getTransaction().begin();
40: final OWLClassQ toRemove = em.find(OWLClassQ.class, entityQ.getUri());
41: assertNotNull(toRemove);
42: em.remove(toRemove);
43: em.getTransaction().commit();
44:
45: assertNull(em.find(OWLClassQ.class, entityQ.getUri()));
46: assertNotNull(em.find(OWLClassA.class, entityA.getUri()));
47: verifyIndividualWasRemoved(entityQ.getUri());
48: }
49:
50: @Test
51: public void testRemoveEntityWithEntitySuperclass() {
52: this.em = getEntityManager("RemoveEntityWithEntitySuperclass", false);
53: persist(entityT, entityA);
54:
55: em.getTransaction().begin();
56: final OWLClassT toRemove = em.find(OWLClassT.class, entityT.getUri());
57: assertNotNull(toRemove);
58: em.remove(toRemove);
59: assertFalse(em.contains(toRemove));
60: em.getTransaction().commit();
61:
62: assertNull(em.find(OWLClassT.class, entityT.getUri()));
63: assertNotNull(em.find(OWLClassA.class, entityA.getUri()));
64: verifyIndividualWasRemoved(entityT.getUri());
65: }
66: }