Exemplo n.º 1
0
 @Value.Check
 protected void checkValidity() {
   // no incomplete response may appear in any response set
   final ImmutableSet<Response> allResponsesInSets = ImmutableSet.copyOf(concat(responseSets()));
   for (final Response incompleteResponse : incompleteResponses()) {
     checkArgument(
         !allResponsesInSets.contains(incompleteResponse),
         "A response may not be both completed and incomplete");
   }
   if (responseSetIds().isPresent()) {
     for (final String id : responseSetIds().get().keySet()) {
       checkArgument(!id.contains("-"), "Event frame IDs may not contain -s");
       checkArgument(!id.contains("\t"), "Event frame IDs may not contain tabs");
     }
     // we can have an empty output file, verify that all the responseSets have an id
     checkArgument(
         responseSets().size() == responseSetIds().get().size(), "Response set IDs are missing");
     checkArgument(
         responseSetIds().get().keySet().size() == responseSets().size(),
         "All response set IDs must be unique");
     CollectionUtils.assertSameElementsOrIllegalArgument(
         responseSets(),
         responseSetIds().get().values(),
         "Response sets did not match IDs",
         "Response sets in list",
         "Response sets in ID map");
   }
 }