google-nomulus/javatests/google/registry
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
..
backup Clean up third_party imports in BUILD files 2018-07-14 01:11:51 -04:00
batch Make loadByForeignKey() and related methods return Optional 2018-12-14 11:24:49 -05:00
beam Run the Spec11 pipeline daily without sending emails 2018-12-12 13:22:34 -05:00
bigquery Use @DefaultCredential for Cloud API access in GAE 2018-09-20 11:19:36 -04:00
builddefs Format .bzl files with buildifier 2018-07-14 01:37:03 -04:00
config Configure client id and client secret in the config file 2018-12-05 16:04:08 -05:00
cron Clean up third_party imports in BUILD files 2018-07-14 01:11:51 -04:00
dns Make loadByForeignKey() and related methods return Optional 2018-12-14 11:24:49 -05:00
export Backup Datastore using the Admin REST API 2018-12-12 13:22:34 -05:00
flows Make loadByForeignKey() and related methods return Optional 2018-12-14 11:24:49 -05:00
groups Add support G-Suite group whose members have ADMIN access to registrar console 2018-11-12 14:51:40 -05:00
keyring Remove the ability to download service account credentials 2018-12-05 16:00:51 -05:00
mapreduce/inputs Clean up internal imports in BUILD files 2018-07-14 01:37:03 -04:00
model Make loadByForeignKey() and related methods return Optional 2018-12-14 11:24:49 -05:00
module Backup Datastore using the Admin REST API 2018-12-12 13:22:34 -05:00
monitoring/whitebox Stop exporting EPP flow metrics to BigQuery 2018-10-08 16:59:29 -04:00
pricing Clean up third_party imports in BUILD files 2018-07-14 01:11:51 -04:00
proxy Make FOSS proxy treat connections with unknown sources more gracefully 2018-12-12 13:22:34 -05:00
rdap Move AuthenticatedRegistrarAccessor to request/auth/ 2018-11-16 16:54:21 -05:00
rde Update lastEppUpdateTime after certain grace period is passed 2018-12-12 13:22:34 -05:00
reporting Isolate customizable code in activity reporting 2018-12-13 15:07:29 -05:00
request Allow only OWNERs to change owner-related data on registrar console 2018-12-03 18:56:28 -05:00
security Improve internal build system speed 2018-06-27 15:28:52 -04:00
server Delete all Braintree code 2018-07-14 01:37:03 -04:00
storage/drive Merge JUnitBackport's expectThrows into assertThrows 2018-03-06 18:56:15 -05:00
testing Remove all mentions of MOE in the code base 2018-12-13 15:09:09 -05:00
tldconfig/idn Remove the use of InjectRule in IdnLabelValidatorTest 2018-10-22 18:54:53 -04:00
tmch Refactor TmchCertificateAuthority 2018-10-25 14:40:38 -04:00
tools Make loadByForeignKey() and related methods return Optional 2018-12-14 11:24:49 -05:00
ui Use goog.html.testing instead of legacy conversions in test 2018-12-12 13:22:34 -05:00
util Isolate customizable code in activity reporting 2018-12-13 15:07:29 -05:00
whois Make loadByForeignKeyCached() return an Optional type 2018-12-12 13:22:34 -05:00
xjc Clean up internal imports in BUILD files 2018-07-14 01:37:03 -04:00
xml Remove unnecessary "throws" declarations 2018-06-18 18:17:56 -04:00