@Test public void getCustomer_shouldReturnNullForNonExistingCustomerId() { short nonExistingCustomerId = 45; Customer customer = customerService.getCustomer(nonExistingCustomerId); assertThat(customer, nullValue()); }
@Nullable public Customer getCustomer(@Nonnull Short customerId) { checkNotNull(customerId, "Argument[customerId] must not be null"); Customer customer = customerMapper.selectByPrimaryKey(customerId); logger.info("Found customer[{}]", customer); return customer; }
CustomerService { @Nullable public Customer getCustomer(@Nonnull Short customerId) { checkNotNull(customerId, "Argument[customerId] must not be null"); Customer customer = customerMapper.selectByPrimaryKey(customerId); logger.info("Found customer[{}]", customer); return customer; } }
CustomerService { @Nullable public Customer getCustomer(@Nonnull Short customerId) { checkNotNull(customerId, "Argument[customerId] must not be null"); Customer customer = customerMapper.selectByPrimaryKey(customerId); logger.info("Found customer[{}]", customer); return customer; } CustomerService(@Nonnull SqlSessionManager sqlSessionManager); }
CustomerService { @Nullable public Customer getCustomer(@Nonnull Short customerId) { checkNotNull(customerId, "Argument[customerId] must not be null"); Customer customer = customerMapper.selectByPrimaryKey(customerId); logger.info("Found customer[{}]", customer); return customer; } CustomerService(@Nonnull SqlSessionManager sqlSessionManager); List<Customer> getAll(); @Nullable Customer getCustomer(@Nonnull Short customerId); @Nonnull Short addCustomer(@Nonnull Customer customer, @Nonnull Address address); @Nonnull List<Customer> getCustomerRewardsReport(
      @Nonnull Byte minMonthlyPurchases, @Nonnull Double minDollarAmountPurchased); }
CustomerService { @Nullable public Customer getCustomer(@Nonnull Short customerId) { checkNotNull(customerId, "Argument[customerId] must not be null"); Customer customer = customerMapper.selectByPrimaryKey(customerId); logger.info("Found customer[{}]", customer); return customer; } CustomerService(@Nonnull SqlSessionManager sqlSessionManager); List<Customer> getAll(); @Nullable Customer getCustomer(@Nonnull Short customerId); @Nonnull Short addCustomer(@Nonnull Customer customer, @Nonnull Address address); @Nonnull List<Customer> getCustomerRewardsReport(
      @Nonnull Byte minMonthlyPurchases, @Nonnull Double minDollarAmountPurchased);  }