google-nomulus/javatests/google/registry/flows
mcilwain 4491b7b909 Make loadByForeignKey() and related methods return Optional
This is safer and addresses a common source of confusion in the codebase because it's always explicit that the resource returned may not be present, whether because it's soft-deleted when projected to the given time or because it never existed in the first place.

In production code, the presence of the returned value is always checked. In test code, its presence is assumed using .get() where that is expected and convenient, as it not being present will throw an NPE that will cause the test to fail anyway.

Note that the roughly equivalent reloadResourceByForeignKey(), which is widely used in test code, is not having this same treatment applied to it. That is out of the scope of this CL, and has much smaller returns anyway because it's only used in tests (where the unexpected absence of a given resource would just cause the test to fail).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=225424002
2018-12-14 11:24:49 -05:00
..
async Test AsyncFlowMetrics without mock 2018-10-22 19:10:01 -04:00
contact Consolidate generic success response XMLs in unit tests 2018-06-27 15:28:52 -04:00
custom Remove unnecessary "throws" declarations 2018-06-18 18:17:56 -04:00
domain Make loadByForeignKey() and related methods return Optional 2018-12-14 11:24:49 -05:00
host Make loadByForeignKey() and related methods return Optional 2018-12-14 11:24:49 -05:00
poll Add more absent clTrid unit tests 2018-06-27 15:28:52 -04:00
session Require SSL certificate hash on login by default 2018-12-12 13:22:34 -05:00
testdata Add an unrenew_domain command to nomulus tool 2018-12-12 13:22:34 -05:00
BUILD Use AuthenticatedRegistrarAccessor in EppConsoleAction 2018-12-03 18:51:40 -05:00
CheckApiActionTest.java Start using non-EPP-flow-wrapping implementation in CheckAPI 2018-06-27 15:28:52 -04:00
EppCommitLogsTest.java Stop exporting EPP flow metrics to BigQuery 2018-10-08 16:59:29 -04:00
EppConsoleActionTest.java Use AuthenticatedRegistrarAccessor in EppConsoleAction 2018-12-03 18:51:40 -05:00
EppControllerTest.java Refactor EppXmlTransformer to be in the model/ package 2018-12-12 13:22:34 -05:00
EppLifecycleContactTest.java Stop exporting EPP flow metrics to BigQuery 2018-10-08 16:59:29 -04:00
EppLifecycleDomainApplicationTest.java Consolidate EPP lifecycle helper methods 2018-12-03 19:17:08 -05:00
EppLifecycleDomainTest.java Make loadByForeignKey() and related methods return Optional 2018-12-14 11:24:49 -05:00
EppLifecycleHostTest.java Make loadByForeignKey() and related methods return Optional 2018-12-14 11:24:49 -05:00
EppLifecycleLoginTest.java Refactor assertCommandAndResponse to be "fluent" 2018-04-02 16:42:59 -04:00
EppLoggedOutTest.java Refactor assertCommandAndResponse to be "fluent" 2018-04-02 16:42:59 -04:00
EppLoginAdminUserTest.java Use AuthenticatedRegistrarAccessor in EppConsoleAction 2018-12-03 18:51:40 -05:00
EppLoginTlsTest.java Require SSL certificate hash on login by default 2018-12-12 13:22:34 -05:00
EppLoginUserTest.java Use AuthenticatedRegistrarAccessor in EppConsoleAction 2018-12-03 18:51:40 -05:00
EppTestCase.java Refactor EppXmlTransformer to be in the model/ package 2018-12-12 13:22:34 -05:00
EppTestComponent.java Refactor TmchCertificateAuthority 2018-10-25 14:40:38 -04:00
EppTlsActionTest.java Remove checking of SNI headers 2018-09-14 21:34:44 -04:00
EppToolActionTest.java Remove unnecessary "throws" declarations 2018-06-18 18:17:56 -04:00
EppXmlSanitizerTest.java Fix bugs exposed by testing with Gradle 2018-10-17 11:44:41 -04:00
EppXxeAttackTest.java Clean up some areas in preparation for externalized codebase 2018-11-16 16:51:11 -05:00
ExtensionManagerTest.java Remove unnecessary "throws" declarations 2018-06-18 18:17:56 -04:00
FlowReporterTest.java Remove unnecessary "throws" declarations 2018-06-18 18:17:56 -04:00
FlowRunnerTest.java Require SSL certificate hash on login by default 2018-12-12 13:22:34 -05:00
FlowTestCase.java Refactor EppXmlTransformer to be in the model/ package 2018-12-12 13:22:34 -05:00
ResourceCheckFlowTestCase.java Add base AllocationToken validation logic for domain checks 2018-01-19 14:32:48 -05:00
ResourceFlowTestCase.java Make loadByForeignKey() and related methods return Optional 2018-12-14 11:24:49 -05:00
TlsCredentialsTest.java Require SSL certificate hash on login by default 2018-12-12 13:22:34 -05:00