|
Play Framework/Scala example source code file (AlgorithmConstraintsParserSpec.scala)
The AlgorithmConstraintsParserSpec.scala Play Framework example source code/* * * * Copyright (C) 2009-2013 Typesafe Inc. <http://www.typesafe.com> * */ package play.api.libs.ws.ssl import org.specs2.mutable._ import scala.util.parsing.input.CharSequenceReader import org.specs2.matcher.{ExpectedParsedResult, ParserMatchers} object AlgorithmConstraintsParserSpec extends Specification with ParserMatchers { val parsers = AlgorithmConstraintsParser import AlgorithmConstraintsParser._ "AlgorithmConstraintParser" should { "succeed to recognize 'MD5, MD2, SHA1'" in { val constraints : List[AlgorithmConstraint] = List(AlgorithmConstraint("MD5"), AlgorithmConstraint("MD2"), AlgorithmConstraint("SHA1")) line must succeedOn("MD5, MD2, SHA1").withResult(constraints:ExpectedParsedResult[List[AlgorithmConstraint]]) } "succeed to recognize 'RSA'" in { expression must succeedOn("RSA").withResult(AlgorithmConstraint("RSA")) } "succeed to recognize 'RSA keySize < 1024'" in { expression must succeedOn("RSA keySize < 1024").withResult(AlgorithmConstraint("RSA", Some(LessThan(1024)))) } "succeed to recognize 'RSA keySize <= 1024'" in { expression must succeedOn("RSA keySize <= 1024").withResult(AlgorithmConstraint("RSA", Some(LessThanOrEqual(1024)))) } "succeed to recognize 'EC keySize > 1024'" in { expression must succeedOn("EC keySize > 1024").withResult(AlgorithmConstraint("EC", Some(MoreThan(1024)))) } "succeed to recognize 'EC keySize >= 1024'" in { expression must succeedOn("EC keySize >= 1024").withResult(AlgorithmConstraint("EC", Some(MoreThanOrEqual(1024)))) } "succeed to recognize 'EC keySize == 1024'" in { expression must succeedOn("EC keySize == 1024").withResult(AlgorithmConstraint("EC", Some(Equal(1024)))) } "succeed to recognize 'EC keySize != 1024'" in { expression must succeedOn("EC keySize != 1024").withResult(AlgorithmConstraint("EC", Some(NotEqual(1024)))) } "fail to recognize 'EC > 1024'" in { expression must failOn("EC > 1024") } "fail to recognize 'EC keySize'" in { expression must failOn("EC keySize") } "fail to recognize ''" in { expression must failOn("") } } } Other Play Framework source code examplesHere is a short list of links related to this Play Framework AlgorithmConstraintsParserSpec.scala source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.