@@ -744,8 +744,8 @@ public void testApiNamingConventions() throws Exception {
744744 assertEquals (0 , method .getExceptionTypes ().length );
745745 assertEquals (3 , method .getParameterTypes ().length );
746746 assertThat (method .getParameterTypes ()[0 ].getSimpleName (), endsWith ("Request" ));
747- assertThat (method .getParameterTypes ()[1 ]. getName () , equalTo (RequestOptions .class . getName () ));
748- assertThat (method .getParameterTypes ()[2 ]. getName () , equalTo (ActionListener .class . getName () ));
747+ assertThat (method .getParameterTypes ()[1 ], equalTo (RequestOptions .class ));
748+ assertThat (method .getParameterTypes ()[2 ], equalTo (ActionListener .class ));
749749 } else {
750750 //A few methods return a boolean rather than a response object
751751 if (apiName .equals ("ping" ) || apiName .contains ("exist" )) {
@@ -758,18 +758,23 @@ public void testApiNamingConventions() throws Exception {
758758 //a few methods don't accept a request object as argument
759759 if (apiName .equals ("ping" ) || apiName .equals ("info" )) {
760760 assertEquals (1 , method .getParameterTypes ().length );
761- assertThat (method .getParameterTypes ()[0 ]. getName () , equalTo (RequestOptions .class . getName () ));
761+ assertThat (method .getParameterTypes ()[0 ], equalTo (RequestOptions .class ));
762762 } else {
763763 assertEquals (apiName , 2 , method .getParameterTypes ().length );
764764 assertThat (method .getParameterTypes ()[0 ].getSimpleName (), endsWith ("Request" ));
765- assertThat (method .getParameterTypes ()[1 ]. getName () , equalTo (RequestOptions .class . getName () ));
765+ assertThat (method .getParameterTypes ()[1 ], equalTo (RequestOptions .class ));
766766 }
767767
768768 boolean remove = apiSpec .remove (apiName );
769- if (remove == false && deprecatedMethods .contains (apiName ) == false ) {
770- //TODO xpack api are currently ignored, we need to load xpack yaml spec too
771- if (apiName .startsWith ("xpack." ) == false ) {
772- apiNotFound .add (apiName );
769+ if (remove == false ) {
770+ if (deprecatedMethods .contains (apiName )) {
771+ assertTrue ("method [" + method .getName () + "], api [" + apiName + "] should be deprecated" ,
772+ method .isAnnotationPresent (Deprecated .class ));
773+ } else {
774+ //TODO xpack api are currently ignored, we need to load xpack yaml spec too
775+ if (apiName .startsWith ("xpack." ) == false ) {
776+ apiNotFound .add (apiName );
777+ }
773778 }
774779 }
775780 }
0 commit comments