-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Core tests #1162
Core tests #1162
Conversation
77b476c
to
a8294ec
Compare
35b80d7
to
75d8630
Compare
b8b3eaa
to
21265e8
Compare
} catch (IOException e) { | ||
throw new UncheckedIOException(e); | ||
} | ||
if (doc2.getData() == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #1163. Moved there.
@@ -110,6 +117,7 @@ public PersistentResourceTest() { | |||
badUserScope = new RequestScope(null, null, mock(DataStoreTransaction.class), | |||
new User(-1), null, elideSettings); | |||
reset(goodUserScope.getTransaction()); | |||
assertFalse(goodUserScope.isUseFilterExpressions()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a test. Why use assert here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this not a test? Will move.
@Test | ||
public void testPatchRequestScope() { | ||
DataStoreTransaction tx = mock(DataStoreTransaction.class); | ||
PatchRequestScope parentScope = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the code actually nest patch scopes like this? I thought patch was the parent scope - but child scopes were always normal request scopes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, they are nested. A new wrapper is generated for each operation in the patch extension. That is what this tests. See
dictionary.bindTrigger(Book.class, OnUpdatePreCommit.class, onUpdateDeferredCallback, true); | ||
dictionary.bindTrigger(Book.class, OnUpdatePreSecurity.class, onUpdateImmediateCallback, true); | ||
dictionary.bindTrigger(Book.class, OnUpdatePostCommit.class, onUpdatePostCommitCallback, true); | ||
dictionary.bindTrigger(Author.class, OnUpdatePostCommit.class, onUpdatePostCommitAuthor, true); | ||
// enable trace | ||
Logger rootLogger = (Logger) LoggerFactory.getILoggerFactory().getLogger(Logger.ROOT_LOGGER_NAME); | ||
rootLogger.setLevel(Level.TRACE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to leave this log level on?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, otherwise we are not testing logging works without throwing exceptions.
Otherwise you need to duplicate all these same tests except with logging on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice coverage bump. Some minor comments/questions.
Description
Adding some missing tests.
Motivation and Context
Better elide-core code coverage
How Has This Been Tested?
Unit testing
License
I confirm that this contribution is made under an Apache 2.0 license and that I have the authority necessary to make this contribution on behalf of its copyright owner.