private Subscription buildTestSubscription() {
   Subscription subscription = new Subscription();
   subscription.setSubscriptionOrder(new SubscriptionOrder());
   subscription.getSubscriptionOrder().setCustomers(new ArrayList<>());
   subscription.setIdentifier("dummy-account");
   return subscription;
 }
  @Test
  public void assignUser() throws JAXBException, IOException {
    Optional<EventType> eventTypeOptional =
        Optional.of(
            SubscriptionServiceIntegrationTest.transform(
                new ClassPathResource("dummyAssign.xml").getInputStream()));

    Subscription subscription = buildTestSubscription();
    User user = new User();
    user.setSubscriptionOrders(new ArrayList<>());
    Mockito.when(userRepository.findByEmail(Mockito.anyString())).thenReturn(user);
    Mockito.when(subscriptionService.getSubscription(Mockito.any()))
        .thenReturn(Optional.of(subscription));

    classUnderTest.assignCustomer(eventTypeOptional);
    userRepository.save(user);
    subscriptionRepository.save(subscription);
    Assert.assertEquals(user, subscription.getSubscriptionOrder().getCustomers().get(0));
  }