PersistenceGsonProvider { public Gson get() { GsonBuilder gsonBuilder = builder(); gsonBuilder.registerTypeAdapter(Date.class, new DateTypeAdapter()); gsonBuilder.registerTypeAdapterFactory(TransactionsTypeAdapter.factory(encryptorProviderService)); gsonBuilder.registerTypeAdapterFactory(CategoriesTypeAdapter.factory(encryptorProviderService)); return gsonBuilder.create(); } @Inject  PersistenceGsonProvider(EncryptorProviderService encryptorProviderService); Gson get();  }
@Test public void categoriesTypeAdapter() { Gson gson = provider.get(); assertEquals(CategoriesTypeAdapter.class, gson.getAdapter(Categories.class).getClass()); }
@Test public void transactionsTypeAdapter() { Gson gson = provider.get(); assertEquals(TransactionsTypeAdapter.class, gson.getAdapter(Transactions.class).getClass()); }