### Question:
Database implements DatabaseDistribution, QueryProvider { @Override @SuppressWarnings("unchecked") public <T, E extends T> Promise<E> readValue(final Class<T> dataType) { checkDatabaseReference(); FilteringStateEnsurer.checkFilteringState(filters, orderByClause, dataType); return ConverterPromise.whenWithConvert(new DatabaseConsumer<ConverterPromise<T, E>>(this) { @Override public void accept(ConverterPromise<T, E> teConverterPromise) { teConverterPromise.with(GdxFIRDatabase.instance().getMapConverter(), dataType); new QueryReadValue(Database.this, getDatabasePath()) .with(getFilters()) .with(getOrderByClause()) .withArgs(dataType) .with(teConverterPromise) .execute(); } }); } Database(); @Override ListenerPromise<ConnectionStatus> onConnect(); @Override DatabaseDistribution inReference(String databasePath); @Override Promise<Void> setValue(final Object value); @Override @SuppressWarnings("unchecked") Promise<E> readValue(final Class<T> dataType); @Override @SuppressWarnings("unchecked") ListenerPromise<R> onDataChange(final Class<T> dataType); @Override ListenerPromise<R> onChildChange(final Class<T> dataType, final ChildEventType... eventsType); @Override @SuppressWarnings("unchecked") DatabaseDistribution filter(FilterType filterType, V... filterArguments); @Override DatabaseDistribution orderBy(OrderByMode orderByMode, String argument); @Override DatabaseDistribution orderBy(OrderByMode orderByMode); @Override DatabaseDistribution push(); @Override Promise<Void> removeValue(); @Override Promise<Void> updateChildren(final Map<String, Object> data); @Override @SuppressWarnings("unchecked") Promise<Void> transaction(final Class<T> dataType, final Function<R, R> transaction); @Override void setPersistenceEnabled(boolean enabled); @Override void keepSynced(boolean synced); @Override String getReferencePath(); @Override Array<Filter> getFilters(); @Override OrderByClause getOrderByClause(); @Override void terminateOperation();  }### Answer:
@Test public void readValue() throws Exception { PowerMockito.mockStatic(QueryReadValue.class); Database database = new Database(); QueryReadValue query = Mockito.spy(new QueryReadValue(database, "/test")); PowerMockito.whenNew(QueryReadValue.class).withAnyArguments().thenReturn(query); database.inReference("/test").readValue(String.class).subscribe(); PowerMockito.verifyNew(QueryReadValue.class); }