@Test
  public void testExcludedClassesExistAndDoNotDeserialize() throws Exception {
    List<String> excludedClasses = loadExcludedClasses(getResourceAsFile(EXCLUDED_CLASSES_TXT));

    initializeSerializationService();

    for (String filePath : excludedClasses) {
      String className = filePath.replaceAll("/", ".");
      System.out.println("testing class " + className);

      Class<?> excludedClass = Class.forName(className);
      if (ignoreClass(excludedClass)) {
        continue;
      }
      assertTrue(
          excludedClass.getName()
              + " is not Serializable and should be removed from excludedClasses.txt",
          Serializable.class.isAssignableFrom(excludedClass));

      if (!excludedClass.isEnum()) {
        final Object excludedInstance;
        try {
          excludedInstance = excludedClass.newInstance();
        } catch (IllegalAccessException | InstantiationException | NullPointerException e) {
          // okay - it's in the excludedClasses.txt file after all
          // IllegalAccessException: thrown when non-private constructor does not exist
          // InstantiationException: thrown when no-arg constructor does not exist
          // NullPointerException: thrown by constructors that fetch RMI dependencies
          continue;
        }
        serializeAndDeserializeObject(excludedInstance);
      }
    }
  }
Prepare your serialization service for use
geode-junit/src/main/java/org/apache/geode/codeAnalysis/AnalyzeDataSerializablesTestBase.java