small test for query string parsing
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/a6e42f4f Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/a6e42f4f Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/a6e42f4f Branch: refs/heads/master Commit: a6e42f4f59043e93dd4e93106ae1d3e450aa7ad7 Parents: 28b3215 Author: Romain Manni-Bucau <[email protected]> Authored: Wed Apr 1 19:54:51 2015 +0200 Committer: Romain Manni-Bucau <[email protected]> Committed: Wed Apr 1 19:54:51 2015 +0200 ---------------------------------------------------------------------- .../openejb/cdi/CdiAppContextsServiceTest.java | 36 ++++++++++++++++++++ 1 file changed, 36 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tomee/blob/a6e42f4f/container/openejb-core/src/test/java/org/apache/openejb/cdi/CdiAppContextsServiceTest.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/test/java/org/apache/openejb/cdi/CdiAppContextsServiceTest.java b/container/openejb-core/src/test/java/org/apache/openejb/cdi/CdiAppContextsServiceTest.java new file mode 100644 index 0000000..e56cc7b --- /dev/null +++ b/container/openejb-core/src/test/java/org/apache/openejb/cdi/CdiAppContextsServiceTest.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.openejb.cdi; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +public class CdiAppContextsServiceTest { + @Test + public void cid() { + assertNull(CdiAppContextsService.getFromQuery(null)); + assertNull(CdiAppContextsService.getFromQuery("")); + assertNull(CdiAppContextsService.getFromQuery("superparam=cejdzl&cfdlcjlzdbc=czlbcjb&cdlzcs&cdlcjkd")); + assertEquals("1", CdiAppContextsService.getFromQuery("cid=1")); + assertEquals("10", CdiAppContextsService.getFromQuery("cid=10")); + assertEquals("10", CdiAppContextsService.getFromQuery("cecfzd=cefczerf&cfdzcd=&é&cdzc&cid=10")); + assertEquals("10", CdiAppContextsService.getFromQuery("cecfzd=cefczerf&cfdzcd=&é&cdzc&cid=10&cdsjlcbdjc=djlbcsjlb=ldjbs=cdsln")); + assertEquals("10", CdiAppContextsService.getFromQuery("cid=10&cdsjlcbdjc=djlbcsjlb=ldjbs=cdsln")); + } +}
