package com.aventstack.extentreports.append;

import java.io.File;
import java.io.IOException;
import java.lang.reflect.Type;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.List;

import com.aventstack.extentreports.gson.BddTypeAdapterFactory;
import com.aventstack.extentreports.model.Media;
import com.aventstack.extentreports.model.Test;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;

public class JsonDeserializer {
    private File f;

    public JsonDeserializer(File f) {
        this.f = f;
    }

    public List<Test> deserialize() throws IOException {
        Gson gson = new GsonBuilder()
                .registerTypeAdapter(Media.class, new ScreenCaptureTypeAdapter())
                .registerTypeAdapterFactory(new BddTypeAdapterFactory())
                .create();
        String json = new String(Files.readAllBytes(f.toPath()));
        Type t = new TypeToken<ArrayList<Test>>() {
        }.getType();
        List<Test> tests = gson.fromJson(json, t);
        return tests;
    }
}
@@ -240,19 +240,26 @@
 ts.gson.
-Bdd
+GsonExtent
 TypeAdap
@@ -265,64 +265,15 @@
 pter
-Factory;%0Aimport com.aventstack.extentreports.model.Media
+Builder
 ;%0Aim
@@ -351,44 +351,8 @@
 on;%0A
-import com.google.gson.GsonBuilder;%0A
 impo
@@ -589,17 +589,38 @@
 n = 
-new GsonB
+GsonExtentTypeAdapterBuilder.b
 uild
@@ -637,32 +637,31 @@
            .
-register
+withBdd
 TypeAdapter(
@@ -663,105 +663,52 @@
 pter
-(Media.class, new ScreenCaptureTypeAdapter())%0A                .registerTypeAdapterFactory(new Bdd
+Factory()%0A                .withScreenCapture
 Type
@@ -714,25 +714,17 @@
 eAdapter
-Factory()
+(
 )%0A      
@@ -738,14 +738,13 @@
    .
-create
+build
 ();%0A

use GsonTypeAdapterBuilder