@Test public void test1Save() { try { Country country = new Country(); country.setCapital("IgjvgrUfs84sjzWopSfdgLdPdbIRn3Qz"); country.setCapitalLatitude(5); country.setCapitalLongitude(1); country.setCountryCode1("ntp"); country.setCountryCode2("Xzp"); country.setCountryFlag("zsX5LRkkQHGDKA0J4jBVwJ852MCEdoP7e8EOS1iW2BIuhos1Ec"); country.setCountryName("FzrugbwLGLsxY3NX0Yx8UOGSodiWe5nKH7s1EnXIDAnDuSeFqH"); country.setCurrencyCode("VOY"); country.setCurrencyName("UN41bj6Ud3jukaJL3Bd7BUdmVq8lUI44UJDHjt5RlPXlujBQOa"); country.setCurrencySymbol("YWs3o5cbPCUouFDipTUfRtmLZnP4aZgu"); country.setIsoNumeric(5); Country CountryTest = countryRepository.save(country); map.put("CountryPrimaryKey", country._getPrimarykey()); Currency currency = new Currency(); currency.setCountryId((java.lang.String) CountryTest._getPrimarykey()); currency.setCurrencyCode("JHdx71fl6fNcUr5trQNWlCv6H91QDTtWaQL1NFXVOdwDvWNcQJ"); currency.setUnicodeDecimal("Ov2aQMMWABkqqD9PYgcKXVxuhqAWGzexbat9yDaLQ2IAaMnLlv"); currency.setUnicodeHex("Bkdhy6EjSRtxU0AddQvoYwqC9rFXSVLSOYBA7bktg7xsP7uHdd"); currency.setEntityAudit(1, "xyz", RECORD_TYPE.ADD); currency.setEntityValidator(entityValidator); currency.isValid(); currencyRepository.save(currency); map.put("CurrencyPrimaryKey", currency._getPrimarykey()); } catch (com.athena.framework.server.exception.biz.SpartanConstraintViolationException e) { org.junit.Assert.fail(e.getMessage()); } catch (java.lang.Exception e) { org.junit.Assert.fail(e.getMessage()); } }
@Test public void test2Update() { try { org.junit.Assert.assertNotNull(map.get("CurrencyPrimaryKey")); Currency currency = currencyRepository.findById((java.lang.String) map.get("CurrencyPrimaryKey")); currency.setCurrencyCode("pHi4xheYbhh1YbGFb8gXCfdShwfv5cIwFag2yMDFIFShiBZPYh"); currency.setUnicodeDecimal("xTDbCj0alDocj3VJ6NlgTBRVk1MYMa7A9xr4aa1WXebHtuKlY6"); currency.setUnicodeHex("KXzfz59O3UiwSHpqEZIPH4xif0K3cYcPngcoma0RXlixDIHLcH"); currency.setVersionId(1); currency.setEntityAudit(1, "xyz", RECORD_TYPE.UPDATE); currencyRepository.update(currency); } catch (com.athena.framework.server.exception.repository.SpartanPersistenceException e) { org.junit.Assert.fail(e.getMessage()); } catch (java.lang.Exception e) { org.junit.Assert.fail(e.getMessage()); } }
@Test public void test3FindById() { try { org.junit.Assert.assertNotNull(map.get("CurrencyPrimaryKey")); currencyRepository.findById((java.lang.String) map.get("CurrencyPrimaryKey")); } catch (com.athena.framework.server.exception.repository.SpartanPersistenceException e) { org.junit.Assert.fail(e.getMessage()); } catch (Exception e) { org.junit.Assert.fail(e.getMessage()); } }
@Test public void test4Delete() { try { org.junit.Assert.assertNotNull(map.get("CurrencyPrimaryKey")); currencyRepository.delete( (java.lang.String) map.get("CurrencyPrimaryKey")); /* Deleting refrenced data */ countryRepository.delete((java.lang.String) map.get("CountryPrimaryKey")); } catch (com.athena.framework.server.exception.repository.SpartanPersistenceException e) { org.junit.Assert.fail(e.getMessage()); } catch (Exception e) { org.junit.Assert.fail(e.getMessage()); } }
@Test public void test3findBycountryId() { try { java.util.List<Currency> listofcountryId = currencyRepository.findByCountryId((java.lang.String) map.get("CountryPrimaryKey")); if (listofcountryId.size() == 0) { org.junit.Assert.fail("Query did not return any records."); } } catch (com.athena.framework.server.exception.repository.SpartanPersistenceException e) { org.junit.Assert.fail(e.getMessage()); } catch (Exception e) { org.junit.Assert.fail(e.getMessage()); } }