From f6dea5f07d595035ee816a6644945b8dffa7c9a7 Mon Sep 17 00:00:00 2001 From: Bogdan Kostov Date: Thu, 4 Jan 2024 22:15:20 +0100 Subject: [PATCH] [kbss-cvut/fta-fmea-ui#131] Add FaultEventDaoTest.testUpdateRectangle --- .../kbss/analysis/dao/FaultEventDaoTest.java | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/test/java/cz/cvut/kbss/analysis/dao/FaultEventDaoTest.java b/src/test/java/cz/cvut/kbss/analysis/dao/FaultEventDaoTest.java index 0e991720..0cac5261 100755 --- a/src/test/java/cz/cvut/kbss/analysis/dao/FaultEventDaoTest.java +++ b/src/test/java/cz/cvut/kbss/analysis/dao/FaultEventDaoTest.java @@ -2,8 +2,7 @@ import cz.cvut.kbss.analysis.environment.Generator; import cz.cvut.kbss.analysis.model.FaultEvent; -import cz.cvut.kbss.analysis.model.util.EventType; -import cz.cvut.kbss.analysis.model.util.GateType; +import cz.cvut.kbss.analysis.model.diagram.Rectangle; import cz.cvut.kbss.analysis.model.fta.FtaEventType; import cz.cvut.kbss.analysis.model.fta.GateType; import cz.cvut.kbss.jopa.model.EntityManager; @@ -60,4 +59,26 @@ public void isChild_isNot_shouldReturnFalse() { Assertions.assertFalse(result); } + @Test + void testUpdateRectangle(){ + Rectangle r = new Rectangle(1.,1.,2.,2.); + + transactional(() -> em.persist(r)); + + double newVal = 10.; + + transactional(() -> { + Rectangle r1 = new Rectangle(); + r1.setUri(r.getUri()); + r1.setX(newVal); + r1.setY(r.getY()); + r1.setWidth(r.getWidth()); + r1.setHeight(r.getHeight()); + faultEventDao.update(r1); + }); + + Rectangle r1 = em.find(Rectangle.class, r.getUri()); + Assertions.assertEquals(r1.getX(), newVal); + } + } \ No newline at end of file