@@ -724,8 +724,8 @@ public void testApiNamingConventions() throws Exception {
724724 assertEquals (0 , method .getExceptionTypes ().length );
725725 assertEquals (3 , method .getParameterTypes ().length );
726726 assertThat (method .getParameterTypes ()[0 ].getSimpleName (), endsWith ("Request" ));
727- assertThat (method .getParameterTypes ()[1 ]. getName () , equalTo (RequestOptions .class . getName () ));
728- assertThat (method .getParameterTypes ()[2 ]. getName () , equalTo (ActionListener .class . getName () ));
727+ assertThat (method .getParameterTypes ()[1 ], equalTo (RequestOptions .class ));
728+ assertThat (method .getParameterTypes ()[2 ], equalTo (ActionListener .class ));
729729 } else {
730730 //A few methods return a boolean rather than a response object
731731 if (apiName .equals ("ping" ) || apiName .contains ("exist" )) {
@@ -738,18 +738,23 @@ public void testApiNamingConventions() throws Exception {
738738 //a few methods don't accept a request object as argument
739739 if (apiName .equals ("ping" ) || apiName .equals ("info" )) {
740740 assertEquals (1 , method .getParameterTypes ().length );
741- assertThat (method .getParameterTypes ()[0 ]. getName () , equalTo (RequestOptions .class . getName () ));
741+ assertThat (method .getParameterTypes ()[0 ], equalTo (RequestOptions .class ));
742742 } else {
743743 assertEquals (apiName , 2 , method .getParameterTypes ().length );
744744 assertThat (method .getParameterTypes ()[0 ].getSimpleName (), endsWith ("Request" ));
745- assertThat (method .getParameterTypes ()[1 ]. getName () , equalTo (RequestOptions .class . getName () ));
745+ assertThat (method .getParameterTypes ()[1 ], equalTo (RequestOptions .class ));
746746 }
747747
748748 boolean remove = apiSpec .remove (apiName );
749- if (remove == false && deprecatedMethods .contains (apiName ) == false ) {
750- //TODO xpack api are currently ignored, we need to load xpack yaml spec too
751- if (apiName .startsWith ("xpack." ) == false ) {
752- apiNotFound .add (apiName );
749+ if (remove == false ) {
750+ if (deprecatedMethods .contains (apiName )) {
751+ assertTrue ("method [" + method .getName () + "], api [" + apiName + "] should be deprecated" ,
752+ method .isAnnotationPresent (Deprecated .class ));
753+ } else {
754+ //TODO xpack api are currently ignored, we need to load xpack yaml spec too
755+ if (apiName .startsWith ("xpack." ) == false ) {
756+ apiNotFound .add (apiName );
757+ }
753758 }
754759 }
755760 }
0 commit comments