test_class.declarator: request
test_class.modifier: @Mock
  	private
test_class.original_string: @Mock
  	private HttpServletRequest request;
test_class.type: HttpServletRequest
test_class.var_name: request
test_class.declarator: response
test_class.modifier: @Mock 
  	private
test_class.original_string: @Mock 
  	private HttpServletResponse response;
test_class.type: HttpServletResponse
test_class.var_name: response
test_class.declarator: brokerApiVersion
test_class.modifier: @Mock
  	private
test_class.original_string: @Mock
  	private BrokerApiVersion brokerApiVersion;
test_class.type: BrokerApiVersion
test_class.var_name: brokerApiVersion
test_class.file: PaaS-TA-Service-Metering-Sample/SERVICE-JAVA-BROKER-SAMPLE/src/test/java/org/openpaas/servicebroker/interceptor/BrokerApiVersionInterceptorTest.java
test_class.identifier: BrokerApiVersionInterceptorTest
test_case.body: @Test(expected = ServiceBrokerApiVersionException.class)
  	public void versionMismatch() throws IOException, ServletException, ServiceBrokerApiVersionException {
  		String header = "header";
  		String version = "version";
  		String notVersion = "not_version";
  		when(brokerApiVersion.getBrokerApiVersionHeader()).thenReturn(header);
  		when(brokerApiVersion.getApiVersions()).thenReturn(version);
  		when(request.getHeader(header)).thenReturn(notVersion);
  		
  		BrokerApiVersionInterceptor interceptor = new BrokerApiVersionInterceptor(brokerApiVersion);
  		interceptor.preHandle(request, response, null);
  		verify(brokerApiVersion).getBrokerApiVersionHeader();
  		verify(brokerApiVersion).getApiVersions();
  	}
test_case.class_method_signature: BrokerApiVersionInterceptorTest.versionMismatch()
test_case.full_signature: @Test(expected = ServiceBrokerApiVersionException.class) public void versionMismatch()
test_case.identifier: versionMismatch
test_case.invocations: thenReturn when getBrokerApiVersionHeader thenReturn when getApiVersions thenReturn when getHeader preHandle getBrokerApiVersionHeader verify getApiVersions verify
test_case.modifiers: @Test(expected = ServiceBrokerApiVersionException.class) public
test_case.parameters: ()
test_case.return: void
test_case.signature: void versionMismatch()
focal_class.declarator: version
focal_class.modifier: private final
focal_class.original_string: private final BrokerApiVersion version;
focal_class.type: BrokerApiVersion
focal_class.var_name: version
focal_class.declarator: LOGGER = getLogger(BrokerApiVersionInterceptor.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = getLogger(BrokerApiVersionInterceptor.class);
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.file: PaaS-TA-Service-Metering-Sample/SERVICE-JAVA-BROKER-SAMPLE/src/main/java/org/openpaas/servicebroker/interceptor/BrokerApiVersionInterceptor.java
focal_class.identifier: BrokerApiVersionInterceptor
focal_class.class_method_signature: BrokerApiVersionInterceptor.BrokerApiVersionInterceptor()
focal_class.full_signature: public  BrokerApiVersionInterceptor()
focal_class.identifier: BrokerApiVersionInterceptor
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  BrokerApiVersionInterceptor()
focal_class.class_method_signature: BrokerApiVersionInterceptor.BrokerApiVersionInterceptor(BrokerApiVersion version)
focal_class.full_signature: public  BrokerApiVersionInterceptor(BrokerApiVersion version)
focal_class.identifier: BrokerApiVersionInterceptor
focal_class.modifiers: public
focal_class.parameters: (BrokerApiVersion version)
focal_class.signature:  BrokerApiVersionInterceptor(BrokerApiVersion version)
focal_class.class_method_signature: BrokerApiVersionInterceptor.preHandle(HttpServletRequest request, HttpServletResponse response,
  			Object handler)
focal_class.full_signature: public boolean preHandle(HttpServletRequest request, HttpServletResponse response,
  			Object handler)
focal_class.identifier: preHandle
focal_class.modifiers: public
focal_class.parameters: (HttpServletRequest request, HttpServletResponse response,
  			Object handler)
focal_class.return: boolean
focal_class.signature: boolean preHandle(HttpServletRequest request, HttpServletResponse response,
  			Object handler)
focal_class.class_method_signature: BrokerApiVersionInterceptor.anyVersionAllowed()
focal_class.full_signature: private boolean anyVersionAllowed()
focal_class.identifier: anyVersionAllowed
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean anyVersionAllowed()
focal_class.superclass: extends HandlerInterceptorAdapter
focal_method.body: public boolean preHandle(HttpServletRequest request, HttpServletResponse response,
  			Object handler) throws ServiceBrokerApiVersionException {
  		if (version != null && !anyVersionAllowed()) {
  			String apiVersion = request.getHeader(version.getBrokerApiVersionHeader());
  			boolean contains = false;
  			for (String brokerApiVersion : version.getApiVersions().split(", ")) {
  				if(brokerApiVersion.contains(".") &&  apiVersion.contains(".")){
  					if("x".equals(brokerApiVersion.split("[.]")[1]) && apiVersion.split("[.]")[0].equals(brokerApiVersion.split("[.]")[0])){
  						contains = true;
  						break;
  					}
  				}
  				if (brokerApiVersion.equals(apiVersion)){
  					contains = true;
  					break;
  				}
  			}
  			if (!contains) {
  				throw new ServiceBrokerApiVersionException(version.getApiVersions(), apiVersion);
  			}
  			 
  		}
  		return true;
  	}
focal_method.class_method_signature: BrokerApiVersionInterceptor.preHandle(HttpServletRequest request, HttpServletResponse response,
  			Object handler)
focal_method.full_signature: public boolean preHandle(HttpServletRequest request, HttpServletResponse response,
  			Object handler)
focal_method.identifier: preHandle
focal_method.invocations: anyVersionAllowed getHeader getBrokerApiVersionHeader split getApiVersions contains contains equals split equals split split equals getApiVersions
focal_method.modifiers: public
focal_method.parameters: (HttpServletRequest request, HttpServletResponse response,
  			Object handler)
focal_method.return: boolean
focal_method.signature: boolean preHandle(HttpServletRequest request, HttpServletResponse response,
  			Object handler)