google-nomulus/javatests/google/registry/model
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
..
billing Delete remnants of registrar-level credits 2018-06-27 15:28:52 -04:00
common Add an auto update time field to the Cursor entity 2018-08-10 13:44:25 -04:00
contact Make loadByForeignKey() and related methods return Optional 2018-12-14 11:24:49 -05:00
domain Make loadByForeignKey() and related methods return Optional 2018-12-14 11:24:49 -05:00
eppcommon Refactor EppXmlTransformer to be in the model/ package 2018-12-12 13:22:34 -05:00
eppinput Refactor EppXmlTransformer to be in the model/ package 2018-12-12 13:22:34 -05:00
eppoutput Remove unnecessary "throws" declarations 2018-06-18 18:17:56 -04:00
host Make loadByForeignKey() and related methods return Optional 2018-12-14 11:24:49 -05:00
index Make loadByForeignKey() and related methods return Optional 2018-12-14 11:24:49 -05:00
mark Remove unnecessary "throws" declarations 2018-06-18 18:17:56 -04:00
ofy Migrate away from VoidWorks 2018-06-27 15:28:52 -04:00
poll Remove unnecessary "throws" declarations 2018-06-18 18:17:56 -04:00
rde Migrate away from VoidWorks 2018-06-27 15:28:52 -04:00
registrar Migrate away from VoidWorks 2018-06-27 15:28:52 -04:00
registry Remove the deprecated MISTAKEN_PREMIUM reservation type 2018-09-14 21:28:23 -04:00
reporting Remove unnecessary "throws" declarations 2018-06-18 18:17:56 -04:00
server Use locking on async mapreduces 2018-08-10 13:44:25 -04:00
smd Remove unnecessary "throws" declarations 2018-06-18 18:17:56 -04:00
testdata Add a RESERVED billing event flag for creates of reserved domains 2018-10-22 18:38:23 -04:00
tmch Explicitly set the shard size when saving the claims list 2018-10-22 19:13:11 -04:00
transfer Remove unnecessary "throws" declarations 2018-06-18 18:17:56 -04:00
translators Refactor EppXmlTransformer to be in the model/ package 2018-12-12 13:22:34 -05:00
BUILD Clean up third_party imports in BUILD files 2018-07-14 01:11:51 -04:00
CreateAutoTimestampTest.java Remove unnecessary "throws" declarations 2018-06-18 18:17:56 -04:00
EntityClassesTest.java Remove unnecessary "throws" declarations 2018-06-18 18:17:56 -04:00
EntityTestCase.java Remove unnecessary "throws" declarations 2018-06-18 18:17:56 -04:00
EppResourceTest.java Make loadByForeignKey() and related methods return Optional 2018-12-14 11:24:49 -05:00
EppResourceUtilsTest.java Remove unnecessary "throws" declarations 2018-06-18 18:17:56 -04:00
ImmutableObjectTest.java Remove unnecessary "throws" declarations 2018-06-18 18:17:56 -04:00
ModelUtilsTest.java Remove unnecessary type specifications 2017-12-27 11:23:03 -05:00
ResourceCommandTestCase.java Refactor EppXmlTransformer to be in the model/ package 2018-12-12 13:22:34 -05:00
SchemaVersionTest.java Remove unnecessary "throws" declarations 2018-06-18 18:17:56 -04:00
UpdateAutoTimestampTest.java Remove unnecessary "throws" declarations 2018-06-18 18:17:56 -04:00