mirror of
https://github.com/google/nomulus.git
synced 2025-05-15 08:57:12 +02:00
Make EppInput.getSingleExtension() return Optional, not @Nullable
This makes it harder to use it incorrectly by accident. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=181795813
This commit is contained in:
parent
fbdb148540
commit
315e6d57bf
21 changed files with 290 additions and 239 deletions
|
@ -43,6 +43,7 @@ import google.registry.model.tmch.ClaimsListShard.ClaimsListRevision;
|
|||
import google.registry.model.tmch.ClaimsListShard.ClaimsListSingleton;
|
||||
import google.registry.testing.TaskQueueHelper.TaskMatcher;
|
||||
import google.registry.util.TypeUtils.TypeInstantiator;
|
||||
import java.util.Optional;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.joda.time.DateTime;
|
||||
|
@ -106,9 +107,11 @@ public abstract class ResourceFlowTestCase<F extends Flow, R extends EppResource
|
|||
* the test code rather than the production code.
|
||||
*/
|
||||
protected String getUniqueIdFromCommand() throws Exception {
|
||||
ApplicationIdTargetExtension extension =
|
||||
Optional<ApplicationIdTargetExtension> extension =
|
||||
eppLoader.getEpp().getSingleExtension(ApplicationIdTargetExtension.class);
|
||||
return extension == null ? getResourceCommand().getTargetId() : extension.getApplicationId();
|
||||
return extension.isPresent()
|
||||
? extension.get().getApplicationId()
|
||||
: getResourceCommand().getTargetId();
|
||||
}
|
||||
|
||||
protected Class<R> getResourceClass() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue