Mercurial > lada > lada-server
comparison src/test/java/de/intevation/lada/test/validator/Probe.java @ 539:deb3fec601ed
Use multivalued map for errors and warnings to be able to store more than one
error/warning per item.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Tue, 24 Feb 2015 14:56:46 +0100 |
parents | bf387959b75e |
children | 2cff9c6c4a9e |
comparison
equal
deleted
inserted
replaced
538:fd927b584c54 | 539:deb3fec601ed |
---|---|
43 protocol.add(prot); | 43 protocol.add(prot); |
44 LProbe probe = new LProbe(); | 44 LProbe probe = new LProbe(); |
45 Violation violation = validator.validate(probe); | 45 Violation violation = validator.validate(probe); |
46 Assert.assertTrue(violation.hasErrors()); | 46 Assert.assertTrue(violation.hasErrors()); |
47 Assert.assertTrue(violation.getErrors().containsKey("hauptprobenNr")); | 47 Assert.assertTrue(violation.getErrors().containsKey("hauptprobenNr")); |
48 Assert.assertTrue(violation.getErrors().get("hauptprobenNr") == 631); | 48 Assert.assertTrue(violation.getErrors().get("hauptprobenNr").contains(631)); |
49 prot.setPassed(true); | 49 prot.setPassed(true); |
50 } | 50 } |
51 | 51 |
52 public final void existingHauptprobenNrNew(List<Protocol> protocol) { | 52 public final void existingHauptprobenNrNew(List<Protocol> protocol) { |
53 Protocol prot = new Protocol(); | 53 Protocol prot = new Protocol(); |
59 probe.setHauptprobenNr("120510002"); | 59 probe.setHauptprobenNr("120510002"); |
60 prot.addInfo("hauptprobenNr", "120510002"); | 60 prot.addInfo("hauptprobenNr", "120510002"); |
61 Violation violation = validator.validate(probe); | 61 Violation violation = validator.validate(probe); |
62 Assert.assertTrue(violation.hasErrors()); | 62 Assert.assertTrue(violation.hasErrors()); |
63 Assert.assertTrue(violation.getErrors().containsKey("hauptprobenNr")); | 63 Assert.assertTrue(violation.getErrors().containsKey("hauptprobenNr")); |
64 Assert.assertTrue(violation.getErrors().get("hauptprobenNr") == 611); | 64 Assert.assertTrue(violation.getErrors().get("hauptprobenNr").contains(611)); |
65 prot.setPassed(true); | 65 prot.setPassed(true); |
66 } | 66 } |
67 | 67 |
68 public final void uniqueHauptprobenNrNew(List<Protocol> protocol) { | 68 public final void uniqueHauptprobenNrNew(List<Protocol> protocol) { |
69 Protocol prot = new Protocol(); | 69 Protocol prot = new Protocol(); |
111 probe.setHauptprobenNr("120224003"); | 111 probe.setHauptprobenNr("120224003"); |
112 prot.addInfo("hauptprobenNr", "120224003"); | 112 prot.addInfo("hauptprobenNr", "120224003"); |
113 Violation violation = validator.validate(probe); | 113 Violation violation = validator.validate(probe); |
114 Assert.assertTrue(violation.hasErrors()); | 114 Assert.assertTrue(violation.hasErrors()); |
115 Assert.assertTrue(violation.getErrors().containsKey("hauptprobenNr")); | 115 Assert.assertTrue(violation.getErrors().containsKey("hauptprobenNr")); |
116 Assert.assertTrue(violation.getErrors().get("hauptprobenNr") == 611); | 116 Assert.assertTrue(violation.getErrors().get("hauptprobenNr").contains(611)); |
117 prot.setPassed(true); | 117 prot.setPassed(true); |
118 } | 118 } |
119 | 119 |
120 public final void hasEntnahmeOrt(List<Protocol> protocol) { | 120 public final void hasEntnahmeOrt(List<Protocol> protocol) { |
121 Protocol prot = new Protocol(); | 121 Protocol prot = new Protocol(); |
141 LProbe probe = new LProbe(); | 141 LProbe probe = new LProbe(); |
142 probe.setId(710); | 142 probe.setId(710); |
143 Violation violation = validator.validate(probe); | 143 Violation violation = validator.validate(probe); |
144 Assert.assertTrue(violation.hasWarnings()); | 144 Assert.assertTrue(violation.hasWarnings()); |
145 Assert.assertTrue(violation.getWarnings().containsKey("entnahmeOrt")); | 145 Assert.assertTrue(violation.getWarnings().containsKey("entnahmeOrt")); |
146 Assert.assertTrue(violation.getWarnings().get("entnahmeOrt") == 631); | 146 Assert.assertTrue(violation.getWarnings().get("entnahmeOrt").contains(631)); |
147 prot.setPassed(true); | 147 prot.setPassed(true); |
148 } | 148 } |
149 | 149 |
150 public final void hasProbeentnahmeBegin(List<Protocol> protocol) { | 150 public final void hasProbeentnahmeBegin(List<Protocol> protocol) { |
151 Protocol prot = new Protocol(); | 151 Protocol prot = new Protocol(); |
153 prot.setType("has probeentnahmeBegin"); | 153 prot.setType("has probeentnahmeBegin"); |
154 prot.setPassed(false); | 154 prot.setPassed(false); |
155 protocol.add(prot); | 155 protocol.add(prot); |
156 LProbe probe = new LProbe(); | 156 LProbe probe = new LProbe(); |
157 probe.setProbeentnahmeBeginn(new Timestamp(1376287046510l)); | 157 probe.setProbeentnahmeBeginn(new Timestamp(1376287046510l)); |
158 probe.setProbeentnahmeEnde(new Timestamp(1376287046511l)); | |
158 Violation violation = validator.validate(probe); | 159 Violation violation = validator.validate(probe); |
159 if (violation.hasWarnings()) { | 160 if (violation.hasWarnings()) { |
160 Assert.assertFalse(violation.getWarnings().containsKey("probeentnahmeBegin")); | 161 Assert.assertFalse(violation.getWarnings().containsKey("probeentnahmeBegin")); |
161 } | 162 } |
162 prot.setPassed(true); | 163 prot.setPassed(true); |
170 protocol.add(prot); | 171 protocol.add(prot); |
171 LProbe probe = new LProbe(); | 172 LProbe probe = new LProbe(); |
172 Violation violation = validator.validate(probe); | 173 Violation violation = validator.validate(probe); |
173 Assert.assertTrue(violation.hasWarnings()); | 174 Assert.assertTrue(violation.hasWarnings()); |
174 Assert.assertTrue(violation.getWarnings().containsKey("probeentnahmeBegin")); | 175 Assert.assertTrue(violation.getWarnings().containsKey("probeentnahmeBegin")); |
175 Assert.assertTrue(violation.getWarnings().get("probeentnahmeBegin") == 631); | 176 Assert.assertTrue(violation.getWarnings().get("probeentnahmeBegin").contains(631)); |
177 prot.setPassed(true); | |
178 } | |
176 prot.setPassed(true); | 179 prot.setPassed(true); |
177 } | 180 } |
178 } | 181 } |