Mercurial > lada > lada-server
comparison src/test/java/de/intevation/lada/test/validator/StatusTest.java @ 1028:1c41c7b8f7c2 schema-update
Updated server application to new database model. THIS IS STILL WIP!!!
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Fri, 08 Jul 2016 15:32:36 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1027:9971471d562c | 1028:1c41c7b8f7c2 |
---|---|
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz | |
2 * Software engineering by Intevation GmbH | |
3 * | |
4 * This file is Free Software under the GNU GPL (v>=3) | |
5 * and comes with ABSOLUTELY NO WARRANTY! Check out | |
6 * the documentation coming with IMIS-Labordaten-Application for details. | |
7 */ | |
8 package de.intevation.lada.test.validator; | |
9 | |
10 import java.util.List; | |
11 | |
12 import org.junit.Assert; | |
13 | |
14 import de.intevation.lada.Protocol; | |
15 import de.intevation.lada.model.land.StatusProtokoll; | |
16 import de.intevation.lada.validation.Validator; | |
17 import de.intevation.lada.validation.Violation; | |
18 | |
19 public class StatusTest { | |
20 | |
21 private Validator validator; | |
22 | |
23 public void setValidator(Validator validator) { | |
24 this.validator = validator; | |
25 } | |
26 | |
27 public final void checkKombiNegative(List<Protocol> protocol) { | |
28 Protocol prot = new Protocol(); | |
29 prot.setName("StatusValidator"); | |
30 prot.setType("check status kombi"); | |
31 prot.setPassed(false); | |
32 protocol.add(prot); | |
33 StatusProtokoll status = new StatusProtokoll(); | |
34 status.setStatusStufe(2); | |
35 status.setStatusWert(7); | |
36 Violation violation = validator.validate(status); | |
37 Assert.assertTrue(violation.hasErrors()); | |
38 Assert.assertTrue(violation.getErrors().containsKey("kombi")); | |
39 Assert.assertTrue(violation.getErrors().get("kombi").contains(632)); | |
40 prot.setPassed(true); | |
41 } | |
42 | |
43 public final void checkKombiPositive(List<Protocol> protocol) { | |
44 Protocol prot = new Protocol(); | |
45 prot.setName("StatusValidator"); | |
46 prot.setType("check status kombi"); | |
47 prot.setPassed(false); | |
48 protocol.add(prot); | |
49 StatusProtokoll status = new StatusProtokoll(); | |
50 status.setStatusStufe(1); | |
51 status.setStatusWert(1); | |
52 Violation violation = validator.validate(status); | |
53 if (violation.hasErrors()) { | |
54 Assert.assertFalse(violation.getErrors().containsKey("kombi")); | |
55 } | |
56 prot.setPassed(true); | |
57 } | |
58 } |