code: public void executeBeforeClass(@Observes BeforeClass event, TestClass testClass) throws Exception{
  		testClass = event.getTestClass();
  
  		//1. Check whether the annotation is present at the class level
  		if (testClass.isAnnotationPresent(Mediaserver.class)) {
  			isMediaserverAnnotationPresentClass = true;
  		}
  
  		//2. Check whether the annotation is present at one of the fields
  		Field[] fields = testClass.getJavaClass().getDeclaredFields();
  		for (Field field : fields) {
  			if (field.isAnnotationPresent(Mediaserver.class)){
  				if (field.getType().isAssignableFrom(EmbeddedMediaserver.class)){
  					isMediaserverAnnotationPresentField = true;
  					deployableServerFields.add(field);
  				}
  			}
  		}
  		//3. Check whether the annotation is present at the test method level
  		Method[] methods = testClass.getMethods(Mediaserver.class); 
  		for (Method method : methods) {
  			if (method.isAnnotationPresent(Mediaserver.class)){
  				isMediaserverAnnotationPresentMethod = true;
  				deployableServerMethods.add(method);
  			}
  		}
  
  		if(deployableServerFields.size()>1)
  			throw new EmbeddedMediaserverException("MediaServer annotation specified many times!");
  
  		//Mediaserver annotation must be defined in only one place
  		if (isMediaserverAnnotationPresentField && (isMediaserverAnnotationPresentClass || isMediaserverAnnotationPresentMethod)
  				|| (isMediaserverAnnotationPresentClass && isMediaserverAnnotationPresentMethod)){
  			throw new EmbeddedMediaserverException("MediaServer annotation specified many times!");
  		}
  
  		//If the annotation is defined in the Class level, the start the server
  		if (isMediaserverAnnotationPresentClass)
  			startAndConfigureServer(testClass.getAnnotation(Mediaserver.class));
  
  	}
docs: /*
  Use @BeforeClass event in order to scan the test class for annotation we might be interesting.
  Event fired Before the Class execution.