@@ -744,8 +744,8 @@ public void testApiNamingConventions() throws Exception {
744
744
assertEquals (0 , method .getExceptionTypes ().length );
745
745
assertEquals (3 , method .getParameterTypes ().length );
746
746
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 ));
749
749
} else {
750
750
//A few methods return a boolean rather than a response object
751
751
if (apiName .equals ("ping" ) || apiName .contains ("exist" )) {
@@ -758,18 +758,23 @@ public void testApiNamingConventions() throws Exception {
758
758
//a few methods don't accept a request object as argument
759
759
if (apiName .equals ("ping" ) || apiName .equals ("info" )) {
760
760
assertEquals (1 , method .getParameterTypes ().length );
761
- assertThat (method .getParameterTypes ()[0 ]. getName () , equalTo (RequestOptions .class . getName () ));
761
+ assertThat (method .getParameterTypes ()[0 ], equalTo (RequestOptions .class ));
762
762
} else {
763
763
assertEquals (apiName , 2 , method .getParameterTypes ().length );
764
764
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 ));
766
766
}
767
767
768
768
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
+ }
773
778
}
774
779
}
775
780
}
0 commit comments