@Test public void testGetRelation() { DataStoreTransaction wrapped = mock(DataStoreTransaction.class); DataStoreTransaction wrapper = new TestTransactionWrapper(wrapped); when(wrapped.getRelation(any(), any(), any(), any(), any(), any(), any())).thenReturn(1L); Object actual = wrapper.getRelation(null, null, null, null, null, null, null); verify(wrapped, times(1)).getRelation(any(), any(), any(), any(), any(), any(), any()); assertEquals(1L, actual); }
@Override public Object getRelation(DataStoreTransaction relationTx, Object entity, String relationName, Optional<FilterExpression> filterExpression, Optional<Sorting> sorting, Optional<Pagination> pagination, RequestScope scope) { return tx.getRelation(relationTx, entity, relationName, filterExpression, sorting, pagination, scope); }
TransactionWrapper implements DataStoreTransaction { @Override public Object getRelation(DataStoreTransaction relationTx, Object entity, String relationName, Optional<FilterExpression> filterExpression, Optional<Sorting> sorting, Optional<Pagination> pagination, RequestScope scope) { return tx.getRelation(relationTx, entity, relationName, filterExpression, sorting, pagination, scope); } }
TransactionWrapper implements DataStoreTransaction { @Override public Object getRelation(DataStoreTransaction relationTx, Object entity, String relationName, Optional<FilterExpression> filterExpression, Optional<Sorting> sorting, Optional<Pagination> pagination, RequestScope scope) { return tx.getRelation(relationTx, entity, relationName, filterExpression, sorting, pagination, scope); }  }
TransactionWrapper implements DataStoreTransaction { @Override public Object getRelation(DataStoreTransaction relationTx, Object entity, String relationName, Optional<FilterExpression> filterExpression, Optional<Sorting> sorting, Optional<Pagination> pagination, RequestScope scope) { return tx.getRelation(relationTx, entity, relationName, filterExpression, sorting, pagination, scope); }  @Override User accessUser(Object opaqueUser); @Override void preCommit(); @Override T createNewObject(Class<T> entityClass); @Override Object loadObject(Class<?> entityClass, Serializable id, Optional<FilterExpression> filterExpression,
                             RequestScope scope); @Override Object getRelation(DataStoreTransaction relationTx, Object entity, String relationName,
                              Optional<FilterExpression> filterExpression, Optional<Sorting> sorting,
                              Optional<Pagination> pagination, RequestScope scope); @Override void updateToManyRelation(DataStoreTransaction relationTx, Object entity, String relationName,
                                     Set<Object> newRelationships, Set<Object> deletedRelationships,
                                     RequestScope scope); @Override void updateToOneRelation(DataStoreTransaction relationTx, Object entity,
                                    String relationName, Object relationshipValue, RequestScope scope); @Override Object getAttribute(Object entity, String attributeName, RequestScope scope); @Override void setAttribute(Object entity, String attributeName, Object attributeValue, RequestScope scope); @Override FeatureSupport supportsFiltering(Class<?> entityClass, FilterExpression expression); @Override boolean supportsSorting(Class<?> entityClass, Sorting sorting); @Override boolean supportsPagination(Class<?> entityClass); @Override void save(Object o, RequestScope requestScope); @Override void delete(Object o, RequestScope requestScope); @Override void flush(RequestScope requestScope); @Override void commit(RequestScope requestScope); @Override void createObject(Object o, RequestScope requestScope); @Override Iterable<Object> loadObjects(Class<?> entityClass,
                                        Optional<FilterExpression> filterExpression,
                                        Optional<Sorting> sorting,
                                        Optional<Pagination> pagination,
                                        RequestScope requestScope); @Override void close(); }
TransactionWrapper implements DataStoreTransaction { @Override public Object getRelation(DataStoreTransaction relationTx, Object entity, String relationName, Optional<FilterExpression> filterExpression, Optional<Sorting> sorting, Optional<Pagination> pagination, RequestScope scope) { return tx.getRelation(relationTx, entity, relationName, filterExpression, sorting, pagination, scope); }  @Override User accessUser(Object opaqueUser); @Override void preCommit(); @Override T createNewObject(Class<T> entityClass); @Override Object loadObject(Class<?> entityClass, Serializable id, Optional<FilterExpression> filterExpression,
                             RequestScope scope); @Override Object getRelation(DataStoreTransaction relationTx, Object entity, String relationName,
                              Optional<FilterExpression> filterExpression, Optional<Sorting> sorting,
                              Optional<Pagination> pagination, RequestScope scope); @Override void updateToManyRelation(DataStoreTransaction relationTx, Object entity, String relationName,
                                     Set<Object> newRelationships, Set<Object> deletedRelationships,
                                     RequestScope scope); @Override void updateToOneRelation(DataStoreTransaction relationTx, Object entity,
                                    String relationName, Object relationshipValue, RequestScope scope); @Override Object getAttribute(Object entity, String attributeName, RequestScope scope); @Override void setAttribute(Object entity, String attributeName, Object attributeValue, RequestScope scope); @Override FeatureSupport supportsFiltering(Class<?> entityClass, FilterExpression expression); @Override boolean supportsSorting(Class<?> entityClass, Sorting sorting); @Override boolean supportsPagination(Class<?> entityClass); @Override void save(Object o, RequestScope requestScope); @Override void delete(Object o, RequestScope requestScope); @Override void flush(RequestScope requestScope); @Override void commit(RequestScope requestScope); @Override void createObject(Object o, RequestScope requestScope); @Override Iterable<Object> loadObjects(Class<?> entityClass,
                                        Optional<FilterExpression> filterExpression,
                                        Optional<Sorting> sorting,
                                        Optional<Pagination> pagination,
                                        RequestScope requestScope); @Override void close();  }