@@ -0,0 +1,2622 @@
+/**%0D%0A * Copyright (C) 2014-2015 Philip Helger (www.helger.com)%0D%0A * philip%5Bat%5Dhelger%5Bdot%5Dcom%0D%0A *%0D%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0D%0A * you may not use this file except in compliance with the License.%0D%0A * You may obtain a copy of the License at%0D%0A *%0D%0A *         http://www.apache.org/licenses/LICENSE-2.0%0D%0A *%0D%0A * Unless required by applicable law or agreed to in writing, software%0D%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0D%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0D%0A * See the License for the specific language governing permissions and%0D%0A * limitations under the License.%0D%0A */%0D%0Apackage com.helger.photon.core.api;%0D%0A%0D%0Aimport static org.junit.Assert.assertNotNull;%0D%0Aimport static org.junit.Assert.assertNull;%0D%0A%0D%0Aimport org.junit.Test;%0D%0A%0D%0Aimport com.helger.web.http.CHTTPHeader;%0D%0Aimport com.helger.web.http.EHTTPMethod;%0D%0A%0D%0A/**%0D%0A * Test class for class %7B@link APIDescriptor%7D.%0D%0A * %0D%0A * @author Philip Helger%0D%0A */%0D%0Apublic final class APIDescriptorTest%0D%0A%7B%0D%0A  @Test%0D%0A  public void testBasic ()%0D%0A  %7B%0D%0A    final APIDescriptorList aList = new APIDescriptorList ();%0D%0A    // Dummy executor%0D%0A    final IAPIExecutor aExec = (a, b, c, d) -%3E %7B%7D;%0D%0A    aList.addDescriptor (APIDescriptor.get (%22/r2o/v1/accessToken%22, aExec).addRequiredParams (%22token%22,%0D%0A                                                                                             %22systemid%22,%0D%0A                                                                                             %22client%22));%0D%0A    aList.addDescriptor (APIDescriptor.delete (%22/service/%7BparticipantID%7D/get%22, aExec));%0D%0A    aList.addDescriptor (APIDescriptor.put (%22/r2o/v1/invoice%22, aExec).addRequiredHeaders (CHTTPHeader.AUTHORIZATION));%0D%0A    aList.addDescriptor (APIDescriptor.put (%22/r2o/%7Bversion:regex=v%5B0-9%5D+%7D/invoice%22, aExec));%0D%0A%0D%0A    assertNotNull (aList.getMatching (%22/r2o/v1/accessToken%22, EHTTPMethod.GET));%0D%0A    assertNull (aList.getMatching (%22/r2o/v1/accessToken%22, EHTTPMethod.POST));%0D%0A    assertNotNull (aList.getMatching (%22/service/12345/get%22, EHTTPMethod.DELETE));%0D%0A    assertNull (aList.getMatching (%22/service/12345/list%22, EHTTPMethod.GET));%0D%0A%0D%0A    // Does not match regex%0D%0A    assertNull (aList.getMatching (%22/r2o/dummy/invoice%22, EHTTPMethod.PUT));%0D%0A    // matches static and regex%0D%0A    assertNull (aList.getMatching (%22/r2o/v1/invoice%22, EHTTPMethod.PUT));%0D%0A    // Matches only the regex%0D%0A    assertNotNull (aList.getMatching (%22/r2o/v24/invoice%22, EHTTPMethod.PUT));%0D%0A    // Matches the regex but invalid HTTP method%0D%0A    assertNull (aList.getMatching (%22/r2o/v24/invoice%22, EHTTPMethod.GET));%0D%0A  %7D%0D%0A%7D%0D%0A

Test case added