Skip to content

Commit

Permalink
[kbss-cvut/fta-fmea-ui#131] Add FaultEventDaoTest.testUpdateRectangle
Browse files Browse the repository at this point in the history
  • Loading branch information
kostobog committed Jan 5, 2024
1 parent 9b21852 commit f6dea5f
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions src/test/java/cz/cvut/kbss/analysis/dao/FaultEventDaoTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

}

0 comments on commit f6dea5f

Please sign in to comment.