@Test public void getDomainByNameTest() throws PacManException { when(domainRepository.existsById(anyString())).thenReturn(true); when(domainRepository.findById(anyString())).thenReturn(getDomainDetails()); assertThat(domainService.getDomainByName(anyString()).getConfig(), is("config123")); }
@Override public Domain getDomainByName(final String domainName) throws PacManException { if(domainRepository.existsById(domainName)) { return domainRepository.findById(domainName).get(); } else { throw new PacManException(AdminConstants.DOMAIN_NAME_EXITS); } }
DomainServiceImpl implements DomainService, Constants { @Override public Domain getDomainByName(final String domainName) throws PacManException { if(domainRepository.existsById(domainName)) { return domainRepository.findById(domainName).get(); } else { throw new PacManException(AdminConstants.DOMAIN_NAME_EXITS); } } }
DomainServiceImpl implements DomainService, Constants { @Override public Domain getDomainByName(final String domainName) throws PacManException { if(domainRepository.existsById(domainName)) { return domainRepository.findById(domainName).get(); } else { throw new PacManException(AdminConstants.DOMAIN_NAME_EXITS); } }  }
DomainServiceImpl implements DomainService, Constants { @Override public Domain getDomainByName(final String domainName) throws PacManException { if(domainRepository.existsById(domainName)) { return domainRepository.findById(domainName).get(); } else { throw new PacManException(AdminConstants.DOMAIN_NAME_EXITS); } }  @Override Collection<String> getAllDomainNames(); @Override List<Domain> getAllDomains(); @Override Domain getDomainByName(final String domainName); @Override Page<Object[]> getAllDomainDetails(final String searchTerm, final int page, final int size); @Override String createDomain(final CreateUpdateDomain createUpdateDomain, final String userId); @Override String updateDomain(final CreateUpdateDomain createUpdateDomain, final String userId); }
DomainServiceImpl implements DomainService, Constants { @Override public Domain getDomainByName(final String domainName) throws PacManException { if(domainRepository.existsById(domainName)) { return domainRepository.findById(domainName).get(); } else { throw new PacManException(AdminConstants.DOMAIN_NAME_EXITS); } }  @Override Collection<String> getAllDomainNames(); @Override List<Domain> getAllDomains(); @Override Domain getDomainByName(final String domainName); @Override Page<Object[]> getAllDomainDetails(final String searchTerm, final int page, final int size); @Override String createDomain(final CreateUpdateDomain createUpdateDomain, final String userId); @Override String updateDomain(final CreateUpdateDomain createUpdateDomain, final String userId);  }