target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test(expected = IllegalArgumentException.class) public void testAssertMatchesRegExpFail1() { Asserts.assertMatchesRegExp("foo", null, "[1-9][0-9]{3} ?[a-zA-Z]{2}"); } | public static void assertMatchesRegExp(String parameter, String value, String regexp) { assertNotNull(parameter, value); assertNotNull("regexp", regexp); Pattern pattern = Pattern.compile(regexp); String trimmedValue = value.trim(); Matcher matcher = pattern.matcher(trimmedValue.subSequence(0, trimmedValue.length())); ... | Asserts { public static void assertMatchesRegExp(String parameter, String value, String regexp) { assertNotNull(parameter, value); assertNotNull("regexp", regexp); Pattern pattern = Pattern.compile(regexp); String trimmedValue = value.trim(); Matcher matcher = pattern.matcher(trimmedValue.subSequence(0, trimmedValue.le... | Asserts { public static void assertMatchesRegExp(String parameter, String value, String regexp) { assertNotNull(parameter, value); assertNotNull("regexp", regexp); Pattern pattern = Pattern.compile(regexp); String trimmedValue = value.trim(); Matcher matcher = pattern.matcher(trimmedValue.subSequence(0, trimmedValue.le... | Asserts { public static void assertMatchesRegExp(String parameter, String value, String regexp) { assertNotNull(parameter, value); assertNotNull("regexp", regexp); Pattern pattern = Pattern.compile(regexp); String trimmedValue = value.trim(); Matcher matcher = pattern.matcher(trimmedValue.subSequence(0, trimmedValue.le... | Asserts { public static void assertMatchesRegExp(String parameter, String value, String regexp) { assertNotNull(parameter, value); assertNotNull("regexp", regexp); Pattern pattern = Pattern.compile(regexp); String trimmedValue = value.trim(); Matcher matcher = pattern.matcher(trimmedValue.subSequence(0, trimmedValue.le... |
@Test(expected = IllegalArgumentException.class) public void testAssertMatchesRegExpFail2() { Asserts.assertMatchesRegExp("foo", "", "[1-9][0-9]{3} ?[a-zA-Z]{2}"); } | public static void assertMatchesRegExp(String parameter, String value, String regexp) { assertNotNull(parameter, value); assertNotNull("regexp", regexp); Pattern pattern = Pattern.compile(regexp); String trimmedValue = value.trim(); Matcher matcher = pattern.matcher(trimmedValue.subSequence(0, trimmedValue.length())); ... | Asserts { public static void assertMatchesRegExp(String parameter, String value, String regexp) { assertNotNull(parameter, value); assertNotNull("regexp", regexp); Pattern pattern = Pattern.compile(regexp); String trimmedValue = value.trim(); Matcher matcher = pattern.matcher(trimmedValue.subSequence(0, trimmedValue.le... | Asserts { public static void assertMatchesRegExp(String parameter, String value, String regexp) { assertNotNull(parameter, value); assertNotNull("regexp", regexp); Pattern pattern = Pattern.compile(regexp); String trimmedValue = value.trim(); Matcher matcher = pattern.matcher(trimmedValue.subSequence(0, trimmedValue.le... | Asserts { public static void assertMatchesRegExp(String parameter, String value, String regexp) { assertNotNull(parameter, value); assertNotNull("regexp", regexp); Pattern pattern = Pattern.compile(regexp); String trimmedValue = value.trim(); Matcher matcher = pattern.matcher(trimmedValue.subSequence(0, trimmedValue.le... | Asserts { public static void assertMatchesRegExp(String parameter, String value, String regexp) { assertNotNull(parameter, value); assertNotNull("regexp", regexp); Pattern pattern = Pattern.compile(regexp); String trimmedValue = value.trim(); Matcher matcher = pattern.matcher(trimmedValue.subSequence(0, trimmedValue.le... |
@Test public void adresControleertPersoon() { class MockBronEduArteModel extends BronEduArteModel { private static final long serialVersionUID = 1L; @Override public boolean isInBronScope(Persoon p) { return true; } } model = new MockBronEduArteModel(); Persoon persoon = new Persoon(); PersoonAdres persoonAdres = perso... | public boolean isInBronScope(Adres adres) { if (adres == null) return false; List<PersoonAdres> persoonAdressen = adres.getPersoonAdressen(); if (persoonAdressen == null || persoonAdressen.isEmpty()) { return false; } for (PersoonAdres persoonAdres : persoonAdressen) { if (isInBronScope(persoonAdres.getPersoon())) retu... | BronEduArteModel { public boolean isInBronScope(Adres adres) { if (adres == null) return false; List<PersoonAdres> persoonAdressen = adres.getPersoonAdressen(); if (persoonAdressen == null || persoonAdressen.isEmpty()) { return false; } for (PersoonAdres persoonAdres : persoonAdressen) { if (isInBronScope(persoonAdres.... | BronEduArteModel { public boolean isInBronScope(Adres adres) { if (adres == null) return false; List<PersoonAdres> persoonAdressen = adres.getPersoonAdressen(); if (persoonAdressen == null || persoonAdressen.isEmpty()) { return false; } for (PersoonAdres persoonAdres : persoonAdressen) { if (isInBronScope(persoonAdres.... | BronEduArteModel { public boolean isInBronScope(Adres adres) { if (adres == null) return false; List<PersoonAdres> persoonAdressen = adres.getPersoonAdressen(); if (persoonAdressen == null || persoonAdressen.isEmpty()) { return false; } for (PersoonAdres persoonAdres : persoonAdressen) { if (isInBronScope(persoonAdres.... | BronEduArteModel { public boolean isInBronScope(Adres adres) { if (adres == null) return false; List<PersoonAdres> persoonAdressen = adres.getPersoonAdressen(); if (persoonAdressen == null || persoonAdressen.isEmpty()) { return false; } for (PersoonAdres persoonAdres : persoonAdressen) { if (isInBronScope(persoonAdres.... |
@Test(expected = IllegalArgumentException.class) public void testAssertMatchesRegExpFail3() { Asserts.assertMatchesRegExp("foo", "abc", "[1-9][0-9]{3} ?[a-zA-Z]{2}"); } | public static void assertMatchesRegExp(String parameter, String value, String regexp) { assertNotNull(parameter, value); assertNotNull("regexp", regexp); Pattern pattern = Pattern.compile(regexp); String trimmedValue = value.trim(); Matcher matcher = pattern.matcher(trimmedValue.subSequence(0, trimmedValue.length())); ... | Asserts { public static void assertMatchesRegExp(String parameter, String value, String regexp) { assertNotNull(parameter, value); assertNotNull("regexp", regexp); Pattern pattern = Pattern.compile(regexp); String trimmedValue = value.trim(); Matcher matcher = pattern.matcher(trimmedValue.subSequence(0, trimmedValue.le... | Asserts { public static void assertMatchesRegExp(String parameter, String value, String regexp) { assertNotNull(parameter, value); assertNotNull("regexp", regexp); Pattern pattern = Pattern.compile(regexp); String trimmedValue = value.trim(); Matcher matcher = pattern.matcher(trimmedValue.subSequence(0, trimmedValue.le... | Asserts { public static void assertMatchesRegExp(String parameter, String value, String regexp) { assertNotNull(parameter, value); assertNotNull("regexp", regexp); Pattern pattern = Pattern.compile(regexp); String trimmedValue = value.trim(); Matcher matcher = pattern.matcher(trimmedValue.subSequence(0, trimmedValue.le... | Asserts { public static void assertMatchesRegExp(String parameter, String value, String regexp) { assertNotNull(parameter, value); assertNotNull("regexp", regexp); Pattern pattern = Pattern.compile(regexp); String trimmedValue = value.trim(); Matcher matcher = pattern.matcher(trimmedValue.subSequence(0, trimmedValue.le... |
@Test public void test0() { Assert.assertEquals("nul", dutch.toWords(0)); } | @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num && num <= 5) { if (remdr > ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... |
@Test public void testMin1() { Assert.assertEquals("min een", dutch.toWords(-1)); } | @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num && num <= 5) { if (remdr > ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... |
@Test public void test1() { Assert.assertEquals("een", dutch.toWords(1)); } | @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num && num <= 5) { if (remdr > ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... |
@Test public void testMin10() { Assert.assertEquals("min tien", dutch.toWords(-10)); } | @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num && num <= 5) { if (remdr > ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... |
@Test public void test10() { Assert.assertEquals("tien", dutch.toWords(10)); } | @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num && num <= 5) { if (remdr > ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... |
@Test public void test21() { Assert.assertEquals("eenentwintig", dutch.toWords(21)); } | @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num && num <= 5) { if (remdr > ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... |
@Test public void testMin100() { Assert.assertEquals("min honderd", dutch.toWords(-100)); } | @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num && num <= 5) { if (remdr > ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... |
@Test public void test100() { Assert.assertEquals("honderd", dutch.toWords(100)); } | @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num && num <= 5) { if (remdr > ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... |
@Test public void test111() { Assert.assertEquals("honderdelf", dutch.toWords(111)); } | @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num && num <= 5) { if (remdr > ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... |
@Test public void medewerkerPersoonControleertNietOfDeelnemerInBronScopeIs() { class MockBronEduArteModel extends BronEduArteModel { private static final long serialVersionUID = 1L; @Override public boolean isInBronScope(Deelnemer deelnemer) { return true; } } model = new MockBronEduArteModel(); Medewerker medewerker =... | public boolean isInBronScope(Adres adres) { if (adres == null) return false; List<PersoonAdres> persoonAdressen = adres.getPersoonAdressen(); if (persoonAdressen == null || persoonAdressen.isEmpty()) { return false; } for (PersoonAdres persoonAdres : persoonAdressen) { if (isInBronScope(persoonAdres.getPersoon())) retu... | BronEduArteModel { public boolean isInBronScope(Adres adres) { if (adres == null) return false; List<PersoonAdres> persoonAdressen = adres.getPersoonAdressen(); if (persoonAdressen == null || persoonAdressen.isEmpty()) { return false; } for (PersoonAdres persoonAdres : persoonAdressen) { if (isInBronScope(persoonAdres.... | BronEduArteModel { public boolean isInBronScope(Adres adres) { if (adres == null) return false; List<PersoonAdres> persoonAdressen = adres.getPersoonAdressen(); if (persoonAdressen == null || persoonAdressen.isEmpty()) { return false; } for (PersoonAdres persoonAdres : persoonAdressen) { if (isInBronScope(persoonAdres.... | BronEduArteModel { public boolean isInBronScope(Adres adres) { if (adres == null) return false; List<PersoonAdres> persoonAdressen = adres.getPersoonAdressen(); if (persoonAdressen == null || persoonAdressen.isEmpty()) { return false; } for (PersoonAdres persoonAdres : persoonAdressen) { if (isInBronScope(persoonAdres.... | BronEduArteModel { public boolean isInBronScope(Adres adres) { if (adres == null) return false; List<PersoonAdres> persoonAdressen = adres.getPersoonAdressen(); if (persoonAdressen == null || persoonAdressen.isEmpty()) { return false; } for (PersoonAdres persoonAdres : persoonAdressen) { if (isInBronScope(persoonAdres.... |
@Test public void testPositive1113() { Assert.assertEquals("elfhonderddertien", dutch.toWords(1113)); } | @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num && num <= 5) { if (remdr > ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... |
@Test public void testPositive1999() { Assert.assertEquals("negentienhonderdnegenennegentig", dutch.toWords(1999)); } | @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num && num <= 5) { if (remdr > ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... |
@Test public void testPositive1miljoen() { Assert.assertEquals("een miljoen", dutch.toWords(1000000)); } | @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num && num <= 5) { if (remdr > ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... | Dutch implements ToWords { @SuppressWarnings("all") public String toWords(long num) { if (num == 0) return ZERO; boolean negative = (num < 0); if (negative) num = -num; String s = ""; for (int group = 0; num > 0; group++) { int remdr = (int) (num % divisor[group]); num = num / divisor[group]; if (group == 1&& 1 <= num ... |
@Test public void getNumberPart1() { String test = "t.o. 12 a"; assertEquals(new Integer(12), StringUtil.getFirstNumberSequence(test)); } | public static Integer getFirstNumberSequence(String tekst) { if (tekst == null) return Integer.valueOf(0); int start = Integer.MAX_VALUE; int end = Integer.MIN_VALUE; boolean inNumberSequence = false; for (int i = 0; i < tekst.length(); i++) { if (tekst.charAt(i) >= '0' && tekst.charAt(i) <= '9') { start = Math.min(i, ... | StringUtil { public static Integer getFirstNumberSequence(String tekst) { if (tekst == null) return Integer.valueOf(0); int start = Integer.MAX_VALUE; int end = Integer.MIN_VALUE; boolean inNumberSequence = false; for (int i = 0; i < tekst.length(); i++) { if (tekst.charAt(i) >= '0' && tekst.charAt(i) <= '9') { start =... | StringUtil { public static Integer getFirstNumberSequence(String tekst) { if (tekst == null) return Integer.valueOf(0); int start = Integer.MAX_VALUE; int end = Integer.MIN_VALUE; boolean inNumberSequence = false; for (int i = 0; i < tekst.length(); i++) { if (tekst.charAt(i) >= '0' && tekst.charAt(i) <= '9') { start =... | StringUtil { public static Integer getFirstNumberSequence(String tekst) { if (tekst == null) return Integer.valueOf(0); int start = Integer.MAX_VALUE; int end = Integer.MIN_VALUE; boolean inNumberSequence = false; for (int i = 0; i < tekst.length(); i++) { if (tekst.charAt(i) >= '0' && tekst.charAt(i) <= '9') { start =... | StringUtil { public static Integer getFirstNumberSequence(String tekst) { if (tekst == null) return Integer.valueOf(0); int start = Integer.MAX_VALUE; int end = Integer.MIN_VALUE; boolean inNumberSequence = false; for (int i = 0; i < tekst.length(); i++) { if (tekst.charAt(i) >= '0' && tekst.charAt(i) <= '9') { start =... |
@Test public void getNumberPart2() { String test = ""; assertNull(StringUtil.getFirstNumberSequence(test)); } | public static Integer getFirstNumberSequence(String tekst) { if (tekst == null) return Integer.valueOf(0); int start = Integer.MAX_VALUE; int end = Integer.MIN_VALUE; boolean inNumberSequence = false; for (int i = 0; i < tekst.length(); i++) { if (tekst.charAt(i) >= '0' && tekst.charAt(i) <= '9') { start = Math.min(i, ... | StringUtil { public static Integer getFirstNumberSequence(String tekst) { if (tekst == null) return Integer.valueOf(0); int start = Integer.MAX_VALUE; int end = Integer.MIN_VALUE; boolean inNumberSequence = false; for (int i = 0; i < tekst.length(); i++) { if (tekst.charAt(i) >= '0' && tekst.charAt(i) <= '9') { start =... | StringUtil { public static Integer getFirstNumberSequence(String tekst) { if (tekst == null) return Integer.valueOf(0); int start = Integer.MAX_VALUE; int end = Integer.MIN_VALUE; boolean inNumberSequence = false; for (int i = 0; i < tekst.length(); i++) { if (tekst.charAt(i) >= '0' && tekst.charAt(i) <= '9') { start =... | StringUtil { public static Integer getFirstNumberSequence(String tekst) { if (tekst == null) return Integer.valueOf(0); int start = Integer.MAX_VALUE; int end = Integer.MIN_VALUE; boolean inNumberSequence = false; for (int i = 0; i < tekst.length(); i++) { if (tekst.charAt(i) >= '0' && tekst.charAt(i) <= '9') { start =... | StringUtil { public static Integer getFirstNumberSequence(String tekst) { if (tekst == null) return Integer.valueOf(0); int start = Integer.MAX_VALUE; int end = Integer.MIN_VALUE; boolean inNumberSequence = false; for (int i = 0; i < tekst.length(); i++) { if (tekst.charAt(i) >= '0' && tekst.charAt(i) <= '9') { start =... |
@Test public void getNumberPart3() { String test = "abcdefg"; assertNull(StringUtil.getFirstNumberSequence(test)); } | public static Integer getFirstNumberSequence(String tekst) { if (tekst == null) return Integer.valueOf(0); int start = Integer.MAX_VALUE; int end = Integer.MIN_VALUE; boolean inNumberSequence = false; for (int i = 0; i < tekst.length(); i++) { if (tekst.charAt(i) >= '0' && tekst.charAt(i) <= '9') { start = Math.min(i, ... | StringUtil { public static Integer getFirstNumberSequence(String tekst) { if (tekst == null) return Integer.valueOf(0); int start = Integer.MAX_VALUE; int end = Integer.MIN_VALUE; boolean inNumberSequence = false; for (int i = 0; i < tekst.length(); i++) { if (tekst.charAt(i) >= '0' && tekst.charAt(i) <= '9') { start =... | StringUtil { public static Integer getFirstNumberSequence(String tekst) { if (tekst == null) return Integer.valueOf(0); int start = Integer.MAX_VALUE; int end = Integer.MIN_VALUE; boolean inNumberSequence = false; for (int i = 0; i < tekst.length(); i++) { if (tekst.charAt(i) >= '0' && tekst.charAt(i) <= '9') { start =... | StringUtil { public static Integer getFirstNumberSequence(String tekst) { if (tekst == null) return Integer.valueOf(0); int start = Integer.MAX_VALUE; int end = Integer.MIN_VALUE; boolean inNumberSequence = false; for (int i = 0; i < tekst.length(); i++) { if (tekst.charAt(i) >= '0' && tekst.charAt(i) <= '9') { start =... | StringUtil { public static Integer getFirstNumberSequence(String tekst) { if (tekst == null) return Integer.valueOf(0); int start = Integer.MAX_VALUE; int end = Integer.MIN_VALUE; boolean inNumberSequence = false; for (int i = 0; i < tekst.length(); i++) { if (tekst.charAt(i) >= '0' && tekst.charAt(i) <= '9') { start =... |
@Test public void getNumberPart4() { String test = "12345678"; assertEquals(new Integer(12345678), StringUtil.getFirstNumberSequence(test)); } | public static Integer getFirstNumberSequence(String tekst) { if (tekst == null) return Integer.valueOf(0); int start = Integer.MAX_VALUE; int end = Integer.MIN_VALUE; boolean inNumberSequence = false; for (int i = 0; i < tekst.length(); i++) { if (tekst.charAt(i) >= '0' && tekst.charAt(i) <= '9') { start = Math.min(i, ... | StringUtil { public static Integer getFirstNumberSequence(String tekst) { if (tekst == null) return Integer.valueOf(0); int start = Integer.MAX_VALUE; int end = Integer.MIN_VALUE; boolean inNumberSequence = false; for (int i = 0; i < tekst.length(); i++) { if (tekst.charAt(i) >= '0' && tekst.charAt(i) <= '9') { start =... | StringUtil { public static Integer getFirstNumberSequence(String tekst) { if (tekst == null) return Integer.valueOf(0); int start = Integer.MAX_VALUE; int end = Integer.MIN_VALUE; boolean inNumberSequence = false; for (int i = 0; i < tekst.length(); i++) { if (tekst.charAt(i) >= '0' && tekst.charAt(i) <= '9') { start =... | StringUtil { public static Integer getFirstNumberSequence(String tekst) { if (tekst == null) return Integer.valueOf(0); int start = Integer.MAX_VALUE; int end = Integer.MIN_VALUE; boolean inNumberSequence = false; for (int i = 0; i < tekst.length(); i++) { if (tekst.charAt(i) >= '0' && tekst.charAt(i) <= '9') { start =... | StringUtil { public static Integer getFirstNumberSequence(String tekst) { if (tekst == null) return Integer.valueOf(0); int start = Integer.MAX_VALUE; int end = Integer.MIN_VALUE; boolean inNumberSequence = false; for (int i = 0; i < tekst.length(); i++) { if (tekst.charAt(i) >= '0' && tekst.charAt(i) <= '9') { start =... |
@Test public void getNumberPart5() { String test = "1234-a"; assertEquals(new Integer(1234), StringUtil.getFirstNumberSequence(test)); } | public static Integer getFirstNumberSequence(String tekst) { if (tekst == null) return Integer.valueOf(0); int start = Integer.MAX_VALUE; int end = Integer.MIN_VALUE; boolean inNumberSequence = false; for (int i = 0; i < tekst.length(); i++) { if (tekst.charAt(i) >= '0' && tekst.charAt(i) <= '9') { start = Math.min(i, ... | StringUtil { public static Integer getFirstNumberSequence(String tekst) { if (tekst == null) return Integer.valueOf(0); int start = Integer.MAX_VALUE; int end = Integer.MIN_VALUE; boolean inNumberSequence = false; for (int i = 0; i < tekst.length(); i++) { if (tekst.charAt(i) >= '0' && tekst.charAt(i) <= '9') { start =... | StringUtil { public static Integer getFirstNumberSequence(String tekst) { if (tekst == null) return Integer.valueOf(0); int start = Integer.MAX_VALUE; int end = Integer.MIN_VALUE; boolean inNumberSequence = false; for (int i = 0; i < tekst.length(); i++) { if (tekst.charAt(i) >= '0' && tekst.charAt(i) <= '9') { start =... | StringUtil { public static Integer getFirstNumberSequence(String tekst) { if (tekst == null) return Integer.valueOf(0); int start = Integer.MAX_VALUE; int end = Integer.MIN_VALUE; boolean inNumberSequence = false; for (int i = 0; i < tekst.length(); i++) { if (tekst.charAt(i) >= '0' && tekst.charAt(i) <= '9') { start =... | StringUtil { public static Integer getFirstNumberSequence(String tekst) { if (tekst == null) return Integer.valueOf(0); int start = Integer.MAX_VALUE; int end = Integer.MIN_VALUE; boolean inNumberSequence = false; for (int i = 0; i < tekst.length(); i++) { if (tekst.charAt(i) >= '0' && tekst.charAt(i) <= '9') { start =... |
@Test public void getNumberPart6() { String test = "123a"; assertEquals(new Integer(123), StringUtil.getFirstNumberSequence(test)); } | public static Integer getFirstNumberSequence(String tekst) { if (tekst == null) return Integer.valueOf(0); int start = Integer.MAX_VALUE; int end = Integer.MIN_VALUE; boolean inNumberSequence = false; for (int i = 0; i < tekst.length(); i++) { if (tekst.charAt(i) >= '0' && tekst.charAt(i) <= '9') { start = Math.min(i, ... | StringUtil { public static Integer getFirstNumberSequence(String tekst) { if (tekst == null) return Integer.valueOf(0); int start = Integer.MAX_VALUE; int end = Integer.MIN_VALUE; boolean inNumberSequence = false; for (int i = 0; i < tekst.length(); i++) { if (tekst.charAt(i) >= '0' && tekst.charAt(i) <= '9') { start =... | StringUtil { public static Integer getFirstNumberSequence(String tekst) { if (tekst == null) return Integer.valueOf(0); int start = Integer.MAX_VALUE; int end = Integer.MIN_VALUE; boolean inNumberSequence = false; for (int i = 0; i < tekst.length(); i++) { if (tekst.charAt(i) >= '0' && tekst.charAt(i) <= '9') { start =... | StringUtil { public static Integer getFirstNumberSequence(String tekst) { if (tekst == null) return Integer.valueOf(0); int start = Integer.MAX_VALUE; int end = Integer.MIN_VALUE; boolean inNumberSequence = false; for (int i = 0; i < tekst.length(); i++) { if (tekst.charAt(i) >= '0' && tekst.charAt(i) <= '9') { start =... | StringUtil { public static Integer getFirstNumberSequence(String tekst) { if (tekst == null) return Integer.valueOf(0); int start = Integer.MAX_VALUE; int end = Integer.MIN_VALUE; boolean inNumberSequence = false; for (int i = 0; i < tekst.length(); i++) { if (tekst.charAt(i) >= '0' && tekst.charAt(i) <= '9') { start =... |
@Test public void getNumberPart7() { String test = "a123"; assertEquals(new Integer(123), StringUtil.getFirstNumberSequence(test)); } | public static Integer getFirstNumberSequence(String tekst) { if (tekst == null) return Integer.valueOf(0); int start = Integer.MAX_VALUE; int end = Integer.MIN_VALUE; boolean inNumberSequence = false; for (int i = 0; i < tekst.length(); i++) { if (tekst.charAt(i) >= '0' && tekst.charAt(i) <= '9') { start = Math.min(i, ... | StringUtil { public static Integer getFirstNumberSequence(String tekst) { if (tekst == null) return Integer.valueOf(0); int start = Integer.MAX_VALUE; int end = Integer.MIN_VALUE; boolean inNumberSequence = false; for (int i = 0; i < tekst.length(); i++) { if (tekst.charAt(i) >= '0' && tekst.charAt(i) <= '9') { start =... | StringUtil { public static Integer getFirstNumberSequence(String tekst) { if (tekst == null) return Integer.valueOf(0); int start = Integer.MAX_VALUE; int end = Integer.MIN_VALUE; boolean inNumberSequence = false; for (int i = 0; i < tekst.length(); i++) { if (tekst.charAt(i) >= '0' && tekst.charAt(i) <= '9') { start =... | StringUtil { public static Integer getFirstNumberSequence(String tekst) { if (tekst == null) return Integer.valueOf(0); int start = Integer.MAX_VALUE; int end = Integer.MIN_VALUE; boolean inNumberSequence = false; for (int i = 0; i < tekst.length(); i++) { if (tekst.charAt(i) >= '0' && tekst.charAt(i) <= '9') { start =... | StringUtil { public static Integer getFirstNumberSequence(String tekst) { if (tekst == null) return Integer.valueOf(0); int start = Integer.MAX_VALUE; int end = Integer.MIN_VALUE; boolean inNumberSequence = false; for (int i = 0; i < tekst.length(); i++) { if (tekst.charAt(i) >= '0' && tekst.charAt(i) <= '9') { start =... |
@Test public void deelnemerPersoonControleertOfDeelnemerInBronScopeIs() { class MockBronEduArteModel extends BronEduArteModel { private static final long serialVersionUID = 1L; @Override public boolean isInBronScope(Deelnemer deelnemer) { return true; } } model = new MockBronEduArteModel(); Deelnemer deelnemer = create... | public boolean isInBronScope(Adres adres) { if (adres == null) return false; List<PersoonAdres> persoonAdressen = adres.getPersoonAdressen(); if (persoonAdressen == null || persoonAdressen.isEmpty()) { return false; } for (PersoonAdres persoonAdres : persoonAdressen) { if (isInBronScope(persoonAdres.getPersoon())) retu... | BronEduArteModel { public boolean isInBronScope(Adres adres) { if (adres == null) return false; List<PersoonAdres> persoonAdressen = adres.getPersoonAdressen(); if (persoonAdressen == null || persoonAdressen.isEmpty()) { return false; } for (PersoonAdres persoonAdres : persoonAdressen) { if (isInBronScope(persoonAdres.... | BronEduArteModel { public boolean isInBronScope(Adres adres) { if (adres == null) return false; List<PersoonAdres> persoonAdressen = adres.getPersoonAdressen(); if (persoonAdressen == null || persoonAdressen.isEmpty()) { return false; } for (PersoonAdres persoonAdres : persoonAdressen) { if (isInBronScope(persoonAdres.... | BronEduArteModel { public boolean isInBronScope(Adres adres) { if (adres == null) return false; List<PersoonAdres> persoonAdressen = adres.getPersoonAdressen(); if (persoonAdressen == null || persoonAdressen.isEmpty()) { return false; } for (PersoonAdres persoonAdres : persoonAdressen) { if (isInBronScope(persoonAdres.... | BronEduArteModel { public boolean isInBronScope(Adres adres) { if (adres == null) return false; List<PersoonAdres> persoonAdressen = adres.getPersoonAdressen(); if (persoonAdressen == null || persoonAdressen.isEmpty()) { return false; } for (PersoonAdres persoonAdres : persoonAdressen) { if (isInBronScope(persoonAdres.... |
@Test public void getNumberPart8() { String test = "a-123"; assertEquals(new Integer(123), StringUtil.getFirstNumberSequence(test)); } | public static Integer getFirstNumberSequence(String tekst) { if (tekst == null) return Integer.valueOf(0); int start = Integer.MAX_VALUE; int end = Integer.MIN_VALUE; boolean inNumberSequence = false; for (int i = 0; i < tekst.length(); i++) { if (tekst.charAt(i) >= '0' && tekst.charAt(i) <= '9') { start = Math.min(i, ... | StringUtil { public static Integer getFirstNumberSequence(String tekst) { if (tekst == null) return Integer.valueOf(0); int start = Integer.MAX_VALUE; int end = Integer.MIN_VALUE; boolean inNumberSequence = false; for (int i = 0; i < tekst.length(); i++) { if (tekst.charAt(i) >= '0' && tekst.charAt(i) <= '9') { start =... | StringUtil { public static Integer getFirstNumberSequence(String tekst) { if (tekst == null) return Integer.valueOf(0); int start = Integer.MAX_VALUE; int end = Integer.MIN_VALUE; boolean inNumberSequence = false; for (int i = 0; i < tekst.length(); i++) { if (tekst.charAt(i) >= '0' && tekst.charAt(i) <= '9') { start =... | StringUtil { public static Integer getFirstNumberSequence(String tekst) { if (tekst == null) return Integer.valueOf(0); int start = Integer.MAX_VALUE; int end = Integer.MIN_VALUE; boolean inNumberSequence = false; for (int i = 0; i < tekst.length(); i++) { if (tekst.charAt(i) >= '0' && tekst.charAt(i) <= '9') { start =... | StringUtil { public static Integer getFirstNumberSequence(String tekst) { if (tekst == null) return Integer.valueOf(0); int start = Integer.MAX_VALUE; int end = Integer.MIN_VALUE; boolean inNumberSequence = false; for (int i = 0; i < tekst.length(); i++) { if (tekst.charAt(i) >= '0' && tekst.charAt(i) <= '9') { start =... |
@Test public void truncate1() { String org = "test"; String replace = ".."; int max = 500; assertEquals(org, StringUtil.truncate(org, max, replace)); } | public static String truncate(String source, int maxLength, String cutoffReplacement) { if (source == null || source.length() <= maxLength) return source; int cutoffLength = maxLength; if (cutoffReplacement != null) cutoffLength -= cutoffReplacement.length(); if (cutoffLength <= 0) { if (cutoffReplacement != null) retu... | StringUtil { public static String truncate(String source, int maxLength, String cutoffReplacement) { if (source == null || source.length() <= maxLength) return source; int cutoffLength = maxLength; if (cutoffReplacement != null) cutoffLength -= cutoffReplacement.length(); if (cutoffLength <= 0) { if (cutoffReplacement ... | StringUtil { public static String truncate(String source, int maxLength, String cutoffReplacement) { if (source == null || source.length() <= maxLength) return source; int cutoffLength = maxLength; if (cutoffReplacement != null) cutoffLength -= cutoffReplacement.length(); if (cutoffLength <= 0) { if (cutoffReplacement ... | StringUtil { public static String truncate(String source, int maxLength, String cutoffReplacement) { if (source == null || source.length() <= maxLength) return source; int cutoffLength = maxLength; if (cutoffReplacement != null) cutoffLength -= cutoffReplacement.length(); if (cutoffLength <= 0) { if (cutoffReplacement ... | StringUtil { public static String truncate(String source, int maxLength, String cutoffReplacement) { if (source == null || source.length() <= maxLength) return source; int cutoffLength = maxLength; if (cutoffReplacement != null) cutoffLength -= cutoffReplacement.length(); if (cutoffLength <= 0) { if (cutoffReplacement ... |
@Test public void truncate2() { String org = "test"; int max = 3; assertEquals("tes", StringUtil.truncate(org, max, null)); } | public static String truncate(String source, int maxLength, String cutoffReplacement) { if (source == null || source.length() <= maxLength) return source; int cutoffLength = maxLength; if (cutoffReplacement != null) cutoffLength -= cutoffReplacement.length(); if (cutoffLength <= 0) { if (cutoffReplacement != null) retu... | StringUtil { public static String truncate(String source, int maxLength, String cutoffReplacement) { if (source == null || source.length() <= maxLength) return source; int cutoffLength = maxLength; if (cutoffReplacement != null) cutoffLength -= cutoffReplacement.length(); if (cutoffLength <= 0) { if (cutoffReplacement ... | StringUtil { public static String truncate(String source, int maxLength, String cutoffReplacement) { if (source == null || source.length() <= maxLength) return source; int cutoffLength = maxLength; if (cutoffReplacement != null) cutoffLength -= cutoffReplacement.length(); if (cutoffLength <= 0) { if (cutoffReplacement ... | StringUtil { public static String truncate(String source, int maxLength, String cutoffReplacement) { if (source == null || source.length() <= maxLength) return source; int cutoffLength = maxLength; if (cutoffReplacement != null) cutoffLength -= cutoffReplacement.length(); if (cutoffLength <= 0) { if (cutoffReplacement ... | StringUtil { public static String truncate(String source, int maxLength, String cutoffReplacement) { if (source == null || source.length() <= maxLength) return source; int cutoffLength = maxLength; if (cutoffReplacement != null) cutoffLength -= cutoffReplacement.length(); if (cutoffLength <= 0) { if (cutoffReplacement ... |
@Test public void truncate3() { String org = "test"; String replace = ".."; int max = 3; assertEquals("t..", StringUtil.truncate(org, max, replace)); } | public static String truncate(String source, int maxLength, String cutoffReplacement) { if (source == null || source.length() <= maxLength) return source; int cutoffLength = maxLength; if (cutoffReplacement != null) cutoffLength -= cutoffReplacement.length(); if (cutoffLength <= 0) { if (cutoffReplacement != null) retu... | StringUtil { public static String truncate(String source, int maxLength, String cutoffReplacement) { if (source == null || source.length() <= maxLength) return source; int cutoffLength = maxLength; if (cutoffReplacement != null) cutoffLength -= cutoffReplacement.length(); if (cutoffLength <= 0) { if (cutoffReplacement ... | StringUtil { public static String truncate(String source, int maxLength, String cutoffReplacement) { if (source == null || source.length() <= maxLength) return source; int cutoffLength = maxLength; if (cutoffReplacement != null) cutoffLength -= cutoffReplacement.length(); if (cutoffLength <= 0) { if (cutoffReplacement ... | StringUtil { public static String truncate(String source, int maxLength, String cutoffReplacement) { if (source == null || source.length() <= maxLength) return source; int cutoffLength = maxLength; if (cutoffReplacement != null) cutoffLength -= cutoffReplacement.length(); if (cutoffLength <= 0) { if (cutoffReplacement ... | StringUtil { public static String truncate(String source, int maxLength, String cutoffReplacement) { if (source == null || source.length() <= maxLength) return source; int cutoffLength = maxLength; if (cutoffReplacement != null) cutoffLength -= cutoffReplacement.length(); if (cutoffLength <= 0) { if (cutoffReplacement ... |
@Test public void truncate4() { String replace = ".."; int max = 500; assertNull(StringUtil.truncate(null, max, replace)); } | public static String truncate(String source, int maxLength, String cutoffReplacement) { if (source == null || source.length() <= maxLength) return source; int cutoffLength = maxLength; if (cutoffReplacement != null) cutoffLength -= cutoffReplacement.length(); if (cutoffLength <= 0) { if (cutoffReplacement != null) retu... | StringUtil { public static String truncate(String source, int maxLength, String cutoffReplacement) { if (source == null || source.length() <= maxLength) return source; int cutoffLength = maxLength; if (cutoffReplacement != null) cutoffLength -= cutoffReplacement.length(); if (cutoffLength <= 0) { if (cutoffReplacement ... | StringUtil { public static String truncate(String source, int maxLength, String cutoffReplacement) { if (source == null || source.length() <= maxLength) return source; int cutoffLength = maxLength; if (cutoffReplacement != null) cutoffLength -= cutoffReplacement.length(); if (cutoffLength <= 0) { if (cutoffReplacement ... | StringUtil { public static String truncate(String source, int maxLength, String cutoffReplacement) { if (source == null || source.length() <= maxLength) return source; int cutoffLength = maxLength; if (cutoffReplacement != null) cutoffLength -= cutoffReplacement.length(); if (cutoffLength <= 0) { if (cutoffReplacement ... | StringUtil { public static String truncate(String source, int maxLength, String cutoffReplacement) { if (source == null || source.length() <= maxLength) return source; int cutoffLength = maxLength; if (cutoffReplacement != null) cutoffLength -= cutoffReplacement.length(); if (cutoffLength <= 0) { if (cutoffReplacement ... |
@Test public void truncate5() { String org = "test"; String replace = ".."; int max = 0; assertEquals(replace, StringUtil.truncate(org, max, replace)); } | public static String truncate(String source, int maxLength, String cutoffReplacement) { if (source == null || source.length() <= maxLength) return source; int cutoffLength = maxLength; if (cutoffReplacement != null) cutoffLength -= cutoffReplacement.length(); if (cutoffLength <= 0) { if (cutoffReplacement != null) retu... | StringUtil { public static String truncate(String source, int maxLength, String cutoffReplacement) { if (source == null || source.length() <= maxLength) return source; int cutoffLength = maxLength; if (cutoffReplacement != null) cutoffLength -= cutoffReplacement.length(); if (cutoffLength <= 0) { if (cutoffReplacement ... | StringUtil { public static String truncate(String source, int maxLength, String cutoffReplacement) { if (source == null || source.length() <= maxLength) return source; int cutoffLength = maxLength; if (cutoffReplacement != null) cutoffLength -= cutoffReplacement.length(); if (cutoffLength <= 0) { if (cutoffReplacement ... | StringUtil { public static String truncate(String source, int maxLength, String cutoffReplacement) { if (source == null || source.length() <= maxLength) return source; int cutoffLength = maxLength; if (cutoffReplacement != null) cutoffLength -= cutoffReplacement.length(); if (cutoffLength <= 0) { if (cutoffReplacement ... | StringUtil { public static String truncate(String source, int maxLength, String cutoffReplacement) { if (source == null || source.length() <= maxLength) return source; int cutoffLength = maxLength; if (cutoffReplacement != null) cutoffLength -= cutoffReplacement.length(); if (cutoffLength <= 0) { if (cutoffReplacement ... |
@Test public void truncate6() { String org = "test"; int max = 0; assertEquals(org, StringUtil.truncate(org, max, null)); } | public static String truncate(String source, int maxLength, String cutoffReplacement) { if (source == null || source.length() <= maxLength) return source; int cutoffLength = maxLength; if (cutoffReplacement != null) cutoffLength -= cutoffReplacement.length(); if (cutoffLength <= 0) { if (cutoffReplacement != null) retu... | StringUtil { public static String truncate(String source, int maxLength, String cutoffReplacement) { if (source == null || source.length() <= maxLength) return source; int cutoffLength = maxLength; if (cutoffReplacement != null) cutoffLength -= cutoffReplacement.length(); if (cutoffLength <= 0) { if (cutoffReplacement ... | StringUtil { public static String truncate(String source, int maxLength, String cutoffReplacement) { if (source == null || source.length() <= maxLength) return source; int cutoffLength = maxLength; if (cutoffReplacement != null) cutoffLength -= cutoffReplacement.length(); if (cutoffLength <= 0) { if (cutoffReplacement ... | StringUtil { public static String truncate(String source, int maxLength, String cutoffReplacement) { if (source == null || source.length() <= maxLength) return source; int cutoffLength = maxLength; if (cutoffReplacement != null) cutoffLength -= cutoffReplacement.length(); if (cutoffLength <= 0) { if (cutoffReplacement ... | StringUtil { public static String truncate(String source, int maxLength, String cutoffReplacement) { if (source == null || source.length() <= maxLength) return source; int cutoffLength = maxLength; if (cutoffReplacement != null) cutoffLength -= cutoffReplacement.length(); if (cutoffLength <= 0) { if (cutoffReplacement ... |
@Test public void truncate7() { String org = "test"; int max = -10; assertEquals(org, StringUtil.truncate(org, max, null)); } | public static String truncate(String source, int maxLength, String cutoffReplacement) { if (source == null || source.length() <= maxLength) return source; int cutoffLength = maxLength; if (cutoffReplacement != null) cutoffLength -= cutoffReplacement.length(); if (cutoffLength <= 0) { if (cutoffReplacement != null) retu... | StringUtil { public static String truncate(String source, int maxLength, String cutoffReplacement) { if (source == null || source.length() <= maxLength) return source; int cutoffLength = maxLength; if (cutoffReplacement != null) cutoffLength -= cutoffReplacement.length(); if (cutoffLength <= 0) { if (cutoffReplacement ... | StringUtil { public static String truncate(String source, int maxLength, String cutoffReplacement) { if (source == null || source.length() <= maxLength) return source; int cutoffLength = maxLength; if (cutoffReplacement != null) cutoffLength -= cutoffReplacement.length(); if (cutoffLength <= 0) { if (cutoffReplacement ... | StringUtil { public static String truncate(String source, int maxLength, String cutoffReplacement) { if (source == null || source.length() <= maxLength) return source; int cutoffLength = maxLength; if (cutoffReplacement != null) cutoffLength -= cutoffReplacement.length(); if (cutoffLength <= 0) { if (cutoffReplacement ... | StringUtil { public static String truncate(String source, int maxLength, String cutoffReplacement) { if (source == null || source.length() <= maxLength) return source; int cutoffLength = maxLength; if (cutoffReplacement != null) cutoffLength -= cutoffReplacement.length(); if (cutoffLength <= 0) { if (cutoffReplacement ... |
@Test public void samenGesteldeLetter() { String naam = "IJsbrand"; String naam1 = "Pietje"; assertEquals("IJ", StringUtil.containsSamengesteldeLetter(naam)); assertEquals("P", StringUtil.containsSamengesteldeLetter(naam1)); } | public static String containsSamengesteldeLetter(String value) { if (isEmpty(value)) return " "; String naam = value.toUpperCase(); for (String letter : SAMENGESTELDE_LETTERS) { if (naam.startsWith(letter)) { return letter; } } return String.valueOf(value.charAt(0)).toUpperCase(); } | StringUtil { public static String containsSamengesteldeLetter(String value) { if (isEmpty(value)) return " "; String naam = value.toUpperCase(); for (String letter : SAMENGESTELDE_LETTERS) { if (naam.startsWith(letter)) { return letter; } } return String.valueOf(value.charAt(0)).toUpperCase(); } } | StringUtil { public static String containsSamengesteldeLetter(String value) { if (isEmpty(value)) return " "; String naam = value.toUpperCase(); for (String letter : SAMENGESTELDE_LETTERS) { if (naam.startsWith(letter)) { return letter; } } return String.valueOf(value.charAt(0)).toUpperCase(); } private StringUtil(); ... | StringUtil { public static String containsSamengesteldeLetter(String value) { if (isEmpty(value)) return " "; String naam = value.toUpperCase(); for (String letter : SAMENGESTELDE_LETTERS) { if (naam.startsWith(letter)) { return letter; } } return String.valueOf(value.charAt(0)).toUpperCase(); } private StringUtil(); ... | StringUtil { public static String containsSamengesteldeLetter(String value) { if (isEmpty(value)) return " "; String naam = value.toUpperCase(); for (String letter : SAMENGESTELDE_LETTERS) { if (naam.startsWith(letter)) { return letter; } } return String.valueOf(value.charAt(0)).toUpperCase(); } private StringUtil(); ... |
@Test public void voorvoegselsEersteLetterHoofdletter() { assertEquals("'T", StringUtil.firstLetterUppercase("'t")); assertEquals("T", StringUtil.firstLetterUppercase("t")); assertEquals("Ten", StringUtil.firstLetterUppercase("ten")); assertEquals("10 Links", StringUtil.firstLetterUppercase("10 links")); assertEquals("... | public static String firstLetterUppercase(String name) { if (StringUtil.isEmpty(name)) return " "; Integer firstLetterPos = null; for (int i = 0; i < name.length() && firstLetterPos == null; i++) { if (Character.isLetter(name.charAt(i))) firstLetterPos = i; } if (firstLetterPos != null) return new StringBuffer(name.len... | StringUtil { public static String firstLetterUppercase(String name) { if (StringUtil.isEmpty(name)) return " "; Integer firstLetterPos = null; for (int i = 0; i < name.length() && firstLetterPos == null; i++) { if (Character.isLetter(name.charAt(i))) firstLetterPos = i; } if (firstLetterPos != null) return new StringBu... | StringUtil { public static String firstLetterUppercase(String name) { if (StringUtil.isEmpty(name)) return " "; Integer firstLetterPos = null; for (int i = 0; i < name.length() && firstLetterPos == null; i++) { if (Character.isLetter(name.charAt(i))) firstLetterPos = i; } if (firstLetterPos != null) return new StringBu... | StringUtil { public static String firstLetterUppercase(String name) { if (StringUtil.isEmpty(name)) return " "; Integer firstLetterPos = null; for (int i = 0; i < name.length() && firstLetterPos == null; i++) { if (Character.isLetter(name.charAt(i))) firstLetterPos = i; } if (firstLetterPos != null) return new StringBu... | StringUtil { public static String firstLetterUppercase(String name) { if (StringUtil.isEmpty(name)) return " "; Integer firstLetterPos = null; for (int i = 0; i < name.length() && firstLetterPos == null; i++) { if (Character.isLetter(name.charAt(i))) firstLetterPos = i; } if (firstLetterPos != null) return new StringBu... |
@Test public void deelnemerMetIntakeVerbintenisNietInScope() { Deelnemer deelnemer = maakDeelnemerMetVerbintenis(Intake); assertFalse(model.isInBronScope(deelnemer)); } | public boolean isInBronScope(Adres adres) { if (adres == null) return false; List<PersoonAdres> persoonAdressen = adres.getPersoonAdressen(); if (persoonAdressen == null || persoonAdressen.isEmpty()) { return false; } for (PersoonAdres persoonAdres : persoonAdressen) { if (isInBronScope(persoonAdres.getPersoon())) retu... | BronEduArteModel { public boolean isInBronScope(Adres adres) { if (adres == null) return false; List<PersoonAdres> persoonAdressen = adres.getPersoonAdressen(); if (persoonAdressen == null || persoonAdressen.isEmpty()) { return false; } for (PersoonAdres persoonAdres : persoonAdressen) { if (isInBronScope(persoonAdres.... | BronEduArteModel { public boolean isInBronScope(Adres adres) { if (adres == null) return false; List<PersoonAdres> persoonAdressen = adres.getPersoonAdressen(); if (persoonAdressen == null || persoonAdressen.isEmpty()) { return false; } for (PersoonAdres persoonAdres : persoonAdressen) { if (isInBronScope(persoonAdres.... | BronEduArteModel { public boolean isInBronScope(Adres adres) { if (adres == null) return false; List<PersoonAdres> persoonAdressen = adres.getPersoonAdressen(); if (persoonAdressen == null || persoonAdressen.isEmpty()) { return false; } for (PersoonAdres persoonAdres : persoonAdressen) { if (isInBronScope(persoonAdres.... | BronEduArteModel { public boolean isInBronScope(Adres adres) { if (adres == null) return false; List<PersoonAdres> persoonAdressen = adres.getPersoonAdressen(); if (persoonAdressen == null || persoonAdressen.isEmpty()) { return false; } for (PersoonAdres persoonAdres : persoonAdressen) { if (isInBronScope(persoonAdres.... |
@Test public void shouldExecuteMainWithoutExceptions() { SpringBootExample.main(new String[0]); } | public static void main(String[] args) { SpringApplication.run(SpringBootExample.class, args); } | SpringBootExample implements CommandLineRunner { public static void main(String[] args) { SpringApplication.run(SpringBootExample.class, args); } } | SpringBootExample implements CommandLineRunner { public static void main(String[] args) { SpringApplication.run(SpringBootExample.class, args); } } | SpringBootExample implements CommandLineRunner { public static void main(String[] args) { SpringApplication.run(SpringBootExample.class, args); } static void main(String[] args); @Override void run(String... args); } | SpringBootExample implements CommandLineRunner { public static void main(String[] args) { SpringApplication.run(SpringBootExample.class, args); } static void main(String[] args); @Override void run(String... args); } |
@Test public void shouldRemoveValue() { Map<String, String> map = new HashMap<>(); map.put("key", "value"); WritableConfigurationSource mapConfigurationSource = new WritableMapConfigurationSource(map); mapConfigurationSource.removeValue("key", null); assertThat(mapConfigurationSource.getValue("key", null).isPresent()).... | @Override public OptionalValue<String> removeValue(String key, Map<String, String> attributes) { requireNonNull(key, "key cannot be null"); return source.containsKey(key) ? present(source.remove(key)) : absent(); } | WritableMapConfigurationSource extends MapConfigurationSource implements WritableConfigurationSource { @Override public OptionalValue<String> removeValue(String key, Map<String, String> attributes) { requireNonNull(key, "key cannot be null"); return source.containsKey(key) ? present(source.remove(key)) : absent(); } } | WritableMapConfigurationSource extends MapConfigurationSource implements WritableConfigurationSource { @Override public OptionalValue<String> removeValue(String key, Map<String, String> attributes) { requireNonNull(key, "key cannot be null"); return source.containsKey(key) ? present(source.remove(key)) : absent(); } Wr... | WritableMapConfigurationSource extends MapConfigurationSource implements WritableConfigurationSource { @Override public OptionalValue<String> removeValue(String key, Map<String, String> attributes) { requireNonNull(key, "key cannot be null"); return source.containsKey(key) ? present(source.remove(key)) : absent(); } Wr... | WritableMapConfigurationSource extends MapConfigurationSource implements WritableConfigurationSource { @Override public OptionalValue<String> removeValue(String key, Map<String, String> attributes) { requireNonNull(key, "key cannot be null"); return source.containsKey(key) ? present(source.remove(key)) : absent(); } Wr... |
@Test public void shouldLoadPropertiesFromFile() { PropertiesConfigurationSource source = new PropertiesConfigurationSource(file.getAbsolutePath()); assertThat(source.getAllConfigurationEntries().iterator()).isEmpty(); } | @Override public Iterable<ConfigurationEntry> getAllConfigurationEntries() { Map<String, String> map = source.entrySet().stream() .filter(e -> e.getValue() instanceof String) .collect(toMap(Object::toString, e -> (String) e.getValue())); return new MapIterable(map); } | PropertiesConfigurationSource implements IterableConfigurationSource { @Override public Iterable<ConfigurationEntry> getAllConfigurationEntries() { Map<String, String> map = source.entrySet().stream() .filter(e -> e.getValue() instanceof String) .collect(toMap(Object::toString, e -> (String) e.getValue())); return new ... | PropertiesConfigurationSource implements IterableConfigurationSource { @Override public Iterable<ConfigurationEntry> getAllConfigurationEntries() { Map<String, String> map = source.entrySet().stream() .filter(e -> e.getValue() instanceof String) .collect(toMap(Object::toString, e -> (String) e.getValue())); return new ... | PropertiesConfigurationSource implements IterableConfigurationSource { @Override public Iterable<ConfigurationEntry> getAllConfigurationEntries() { Map<String, String> map = source.entrySet().stream() .filter(e -> e.getValue() instanceof String) .collect(toMap(Object::toString, e -> (String) e.getValue())); return new ... | PropertiesConfigurationSource implements IterableConfigurationSource { @Override public Iterable<ConfigurationEntry> getAllConfigurationEntries() { Map<String, String> map = source.entrySet().stream() .filter(e -> e.getValue() instanceof String) .collect(toMap(Object::toString, e -> (String) e.getValue())); return new ... |
@Test public void shouldConvertFromString() { Pattern pattern = Pattern.compile(".*"); Pattern value = converter.fromString(Pattern.class, ".*", null); assertThat(value.pattern()).isEqualTo(pattern.pattern()); } | @Override public Pattern fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); try { return (value == null) ? null : Pattern.compile(value); } catch (PatternSyntaxException e) { throw new IllegalArgumentException("Unable to convert to a Pattern: " + value, e)... | PatternConverter implements TypeConverter<Pattern> { @Override public Pattern fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); try { return (value == null) ? null : Pattern.compile(value); } catch (PatternSyntaxException e) { throw new IllegalArgumentExc... | PatternConverter implements TypeConverter<Pattern> { @Override public Pattern fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); try { return (value == null) ? null : Pattern.compile(value); } catch (PatternSyntaxException e) { throw new IllegalArgumentExc... | PatternConverter implements TypeConverter<Pattern> { @Override public Pattern fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); try { return (value == null) ? null : Pattern.compile(value); } catch (PatternSyntaxException e) { throw new IllegalArgumentExc... | PatternConverter implements TypeConverter<Pattern> { @Override public Pattern fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); try { return (value == null) ? null : Pattern.compile(value); } catch (PatternSyntaxException e) { throw new IllegalArgumentExc... |
@Test public void shouldThrowExceptionWhenConvertingFromStringAndWrongValue() { String value = "{"; assertThatThrownBy(() -> converter.fromString(Pattern.class, value, null)) .isExactlyInstanceOf(IllegalArgumentException.class) .hasMessageContaining("Unable to convert to a Pattern:"); } | @Override public Pattern fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); try { return (value == null) ? null : Pattern.compile(value); } catch (PatternSyntaxException e) { throw new IllegalArgumentException("Unable to convert to a Pattern: " + value, e)... | PatternConverter implements TypeConverter<Pattern> { @Override public Pattern fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); try { return (value == null) ? null : Pattern.compile(value); } catch (PatternSyntaxException e) { throw new IllegalArgumentExc... | PatternConverter implements TypeConverter<Pattern> { @Override public Pattern fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); try { return (value == null) ? null : Pattern.compile(value); } catch (PatternSyntaxException e) { throw new IllegalArgumentExc... | PatternConverter implements TypeConverter<Pattern> { @Override public Pattern fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); try { return (value == null) ? null : Pattern.compile(value); } catch (PatternSyntaxException e) { throw new IllegalArgumentExc... | PatternConverter implements TypeConverter<Pattern> { @Override public Pattern fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); try { return (value == null) ? null : Pattern.compile(value); } catch (PatternSyntaxException e) { throw new IllegalArgumentExc... |
@Test public void shouldConvertToString() { Pattern pattern = Pattern.compile("123.*"); String asString = converter.toString(Pattern.class, pattern, null); assertThat(asString).isEqualTo(pattern.toString()); } | @Override public String toString(Type type, Pattern value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return Objects.toString(value, null); } | PatternConverter implements TypeConverter<Pattern> { @Override public String toString(Type type, Pattern value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return Objects.toString(value, null); } } | PatternConverter implements TypeConverter<Pattern> { @Override public String toString(Type type, Pattern value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return Objects.toString(value, null); } } | PatternConverter implements TypeConverter<Pattern> { @Override public String toString(Type type, Pattern value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return Objects.toString(value, null); } @Override boolean isApplicable(Type type, Map<String, String> attributes); @Override Pat... | PatternConverter implements TypeConverter<Pattern> { @Override public String toString(Type type, Pattern value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return Objects.toString(value, null); } @Override boolean isApplicable(Type type, Map<String, String> attributes); @Override Pat... |
@Test public void shouldAcceptType() { Type type = Pattern.class; boolean isApplicable = converter.isApplicable(type, null); assertThat(isApplicable).isTrue(); } | @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Pattern.class.isAssignableFrom((Class<?>) type); } | PatternConverter implements TypeConverter<Pattern> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Pattern.class.isAssignableFrom((Class<?>) type); } } | PatternConverter implements TypeConverter<Pattern> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Pattern.class.isAssignableFrom((Class<?>) type); } } | PatternConverter implements TypeConverter<Pattern> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Pattern.class.isAssignableFrom((Class<?>) type); } @Override boolean isApplicable(Type type, Map<String... | PatternConverter implements TypeConverter<Pattern> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Pattern.class.isAssignableFrom((Class<?>) type); } @Override boolean isApplicable(Type type, Map<String... |
@Test public void shouldNotAcceptUnknownType() { boolean isApplicable = converter.isApplicable(mock(Type.class), null); assertThat(isApplicable).isFalse(); } | @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Pattern.class.isAssignableFrom((Class<?>) type); } | PatternConverter implements TypeConverter<Pattern> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Pattern.class.isAssignableFrom((Class<?>) type); } } | PatternConverter implements TypeConverter<Pattern> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Pattern.class.isAssignableFrom((Class<?>) type); } } | PatternConverter implements TypeConverter<Pattern> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Pattern.class.isAssignableFrom((Class<?>) type); } @Override boolean isApplicable(Type type, Map<String... | PatternConverter implements TypeConverter<Pattern> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Pattern.class.isAssignableFrom((Class<?>) type); } @Override boolean isApplicable(Type type, Map<String... |
@Test public void shouldFailInCaseEndingObjectWhenArrayWasBegun() { assertThatThrowExceptionOfType( new ObjectBuilder().beginList()::endMap, IllegalStateException.class); } | ObjectBuilder beginList() { return beginList(new ArrayList<>()); } | ObjectBuilder { ObjectBuilder beginList() { return beginList(new ArrayList<>()); } } | ObjectBuilder { ObjectBuilder beginList() { return beginList(new ArrayList<>()); } } | ObjectBuilder { ObjectBuilder beginList() { return beginList(new ArrayList<>()); } } | ObjectBuilder { ObjectBuilder beginList() { return beginList(new ArrayList<>()); } } |
@Test public void shouldFailInCaseEndingArrayWhenObjectWasBegun() { assertThatThrowExceptionOfType( new ObjectBuilder().beginMap()::endList, IllegalStateException.class); } | ObjectBuilder beginMap() { return beginMap(new LinkedHashMap<>()); } | ObjectBuilder { ObjectBuilder beginMap() { return beginMap(new LinkedHashMap<>()); } } | ObjectBuilder { ObjectBuilder beginMap() { return beginMap(new LinkedHashMap<>()); } } | ObjectBuilder { ObjectBuilder beginMap() { return beginMap(new LinkedHashMap<>()); } } | ObjectBuilder { ObjectBuilder beginMap() { return beginMap(new LinkedHashMap<>()); } } |
@Test public void shouldProperlyReturnNotEscapedIndexOf() { assertThat(TypeConverterUtils.notEscapedIndexOf("abcb", 0, 'b')).isEqualTo(1); assertThat(TypeConverterUtils.notEscapedIndexOf("a\\bcb", 0, 'b')).isEqualTo(4); assertThat(TypeConverterUtils.notEscapedIndexOf("a\\b\\\\bcb", 0, 'b')).isEqualTo(5); } | static int notEscapedIndexOf(CharSequence value, int startPos, char character) { Objects.requireNonNull(value, "value must not be null"); char prev = 0xffff; for (int i = max(startPos, 0), len = value.length(); i < len; i++) { char current = value.charAt(i); if (current == character) { if (prev == ESCAPE_CHAR) { int m ... | TypeConverterUtils { static int notEscapedIndexOf(CharSequence value, int startPos, char character) { Objects.requireNonNull(value, "value must not be null"); char prev = 0xffff; for (int i = max(startPos, 0), len = value.length(); i < len; i++) { char current = value.charAt(i); if (current == character) { if (prev == ... | TypeConverterUtils { static int notEscapedIndexOf(CharSequence value, int startPos, char character) { Objects.requireNonNull(value, "value must not be null"); char prev = 0xffff; for (int i = max(startPos, 0), len = value.length(); i < len; i++) { char current = value.charAt(i); if (current == character) { if (prev == ... | TypeConverterUtils { static int notEscapedIndexOf(CharSequence value, int startPos, char character) { Objects.requireNonNull(value, "value must not be null"); char prev = 0xffff; for (int i = max(startPos, 0), len = value.length(); i < len; i++) { char current = value.charAt(i); if (current == character) { if (prev == ... | TypeConverterUtils { static int notEscapedIndexOf(CharSequence value, int startPos, char character) { Objects.requireNonNull(value, "value must not be null"); char prev = 0xffff; for (int i = max(startPos, 0), len = value.length(); i < len; i++) { char current = value.charAt(i); if (current == character) { if (prev == ... |
@Test public void shouldReturnNullObjectForBlankXML() { String resource = " "; XmlRootConfiguration01 xmlRootConfiguration01 = (XmlRootConfiguration01) jaxbTypeConverter.fromString(XmlRootConfiguration01.class, resource, null); assertThat(xmlRootConfiguration01).isNull(); } | @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (isBlank(value)) { return null; } @SuppressWarnings("unchecked") Class<T> targetClazz = (Class<T>) type; JaxbPool jaxbPool = getJaxbPool(targetClazz); try (Handle<Unmarshaller> handle... | JaxbConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (isBlank(value)) { return null; } @SuppressWarnings("unchecked") Class<T> targetClazz = (Class<T>) type; JaxbPool jaxbPool = getJaxbPool(ta... | JaxbConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (isBlank(value)) { return null; } @SuppressWarnings("unchecked") Class<T> targetClazz = (Class<T>) type; JaxbPool jaxbPool = getJaxbPool(ta... | JaxbConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (isBlank(value)) { return null; } @SuppressWarnings("unchecked") Class<T> targetClazz = (Class<T>) type; JaxbPool jaxbPool = getJaxbPool(ta... | JaxbConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (isBlank(value)) { return null; } @SuppressWarnings("unchecked") Class<T> targetClazz = (Class<T>) type; JaxbPool jaxbPool = getJaxbPool(ta... |
@Test public void shouldProperlyReturnNotEscapedIndexOfMultiArgs() { assertThat(TypeConverterUtils.notEscapedIndexOf("abcb", 0, 'b', 'a')).isEqualTo(0); assertThat(TypeConverterUtils.notEscapedIndexOf("a\\bcb", 0, 'b', 'c')).isEqualTo(3); assertThat(TypeConverterUtils.notEscapedIndexOf("a\\b\\\\cb", 0, 'b', 'c')).isEqu... | static int notEscapedIndexOf(CharSequence value, int startPos, char character) { Objects.requireNonNull(value, "value must not be null"); char prev = 0xffff; for (int i = max(startPos, 0), len = value.length(); i < len; i++) { char current = value.charAt(i); if (current == character) { if (prev == ESCAPE_CHAR) { int m ... | TypeConverterUtils { static int notEscapedIndexOf(CharSequence value, int startPos, char character) { Objects.requireNonNull(value, "value must not be null"); char prev = 0xffff; for (int i = max(startPos, 0), len = value.length(); i < len; i++) { char current = value.charAt(i); if (current == character) { if (prev == ... | TypeConverterUtils { static int notEscapedIndexOf(CharSequence value, int startPos, char character) { Objects.requireNonNull(value, "value must not be null"); char prev = 0xffff; for (int i = max(startPos, 0), len = value.length(); i < len; i++) { char current = value.charAt(i); if (current == character) { if (prev == ... | TypeConverterUtils { static int notEscapedIndexOf(CharSequence value, int startPos, char character) { Objects.requireNonNull(value, "value must not be null"); char prev = 0xffff; for (int i = max(startPos, 0), len = value.length(); i < len; i++) { char current = value.charAt(i); if (current == character) { if (prev == ... | TypeConverterUtils { static int notEscapedIndexOf(CharSequence value, int startPos, char character) { Objects.requireNonNull(value, "value must not be null"); char prev = 0xffff; for (int i = max(startPos, 0), len = value.length(); i < len; i++) { char current = value.charAt(i); if (current == character) { if (prev == ... |
@Test public void shouldConvertFromString() { Period period = Period.ofDays(123); Period readPeriod = converter.fromString(Period.class, "P123D", null); assertThat(readPeriod).isEqualTo(period); } | @Override public Period fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); try { return value == null ? null : Period.parse(value); } catch (DateTimeParseException e) { throw new IllegalArgumentException(format("Unable to convert to a Period: %s", value), ... | PeriodConverter implements TypeConverter<Period> { @Override public Period fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); try { return value == null ? null : Period.parse(value); } catch (DateTimeParseException e) { throw new IllegalArgumentException(f... | PeriodConverter implements TypeConverter<Period> { @Override public Period fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); try { return value == null ? null : Period.parse(value); } catch (DateTimeParseException e) { throw new IllegalArgumentException(f... | PeriodConverter implements TypeConverter<Period> { @Override public Period fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); try { return value == null ? null : Period.parse(value); } catch (DateTimeParseException e) { throw new IllegalArgumentException(f... | PeriodConverter implements TypeConverter<Period> { @Override public Period fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); try { return value == null ? null : Period.parse(value); } catch (DateTimeParseException e) { throw new IllegalArgumentException(f... |
@Test public void shouldConvertToString() { Period period = Period.ofDays(123); String asString = converter.toString(Period.class, period, null); assertThat(asString).isEqualTo("P123D"); } | @Override public String toString(Type type, Period value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return Objects.toString(value, null); } | PeriodConverter implements TypeConverter<Period> { @Override public String toString(Type type, Period value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return Objects.toString(value, null); } } | PeriodConverter implements TypeConverter<Period> { @Override public String toString(Type type, Period value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return Objects.toString(value, null); } } | PeriodConverter implements TypeConverter<Period> { @Override public String toString(Type type, Period value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return Objects.toString(value, null); } @Override boolean isApplicable(Type type, Map<String, String> attributes); @Override Period... | PeriodConverter implements TypeConverter<Period> { @Override public String toString(Type type, Period value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return Objects.toString(value, null); } @Override boolean isApplicable(Type type, Map<String, String> attributes); @Override Period... |
@Test public void shouldAcceptPeriodType() { Type type = Period.class; boolean isApplicable = converter.isApplicable(type, null); assertThat(isApplicable).isTrue(); } | @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Period.class.isAssignableFrom((Class<?>) type); } | PeriodConverter implements TypeConverter<Period> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Period.class.isAssignableFrom((Class<?>) type); } } | PeriodConverter implements TypeConverter<Period> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Period.class.isAssignableFrom((Class<?>) type); } } | PeriodConverter implements TypeConverter<Period> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Period.class.isAssignableFrom((Class<?>) type); } @Override boolean isApplicable(Type type, Map<String, S... | PeriodConverter implements TypeConverter<Period> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Period.class.isAssignableFrom((Class<?>) type); } @Override boolean isApplicable(Type type, Map<String, S... |
@Test public void shouldNotAcceptUnknownType() { boolean isApplicable = converter.isApplicable(mock(Type.class), null); assertThat(isApplicable).isFalse(); } | @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Period.class.isAssignableFrom((Class<?>) type); } | PeriodConverter implements TypeConverter<Period> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Period.class.isAssignableFrom((Class<?>) type); } } | PeriodConverter implements TypeConverter<Period> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Period.class.isAssignableFrom((Class<?>) type); } } | PeriodConverter implements TypeConverter<Period> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Period.class.isAssignableFrom((Class<?>) type); } @Override boolean isApplicable(Type type, Map<String, S... | PeriodConverter implements TypeConverter<Period> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Period.class.isAssignableFrom((Class<?>) type); } @Override boolean isApplicable(Type type, Map<String, S... |
@Test public void shouldThrowExceptionWhenConvertingFromStringAndWrongValue() { String toConvert = "XXXXX"; assertThatThrownBy(() -> converter.fromString(Period.class, toConvert, null)) .isExactlyInstanceOf(IllegalArgumentException.class) .hasMessage("Unable to convert to a Period: XXXXX"); } | @Override public Period fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); try { return value == null ? null : Period.parse(value); } catch (DateTimeParseException e) { throw new IllegalArgumentException(format("Unable to convert to a Period: %s", value), ... | PeriodConverter implements TypeConverter<Period> { @Override public Period fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); try { return value == null ? null : Period.parse(value); } catch (DateTimeParseException e) { throw new IllegalArgumentException(f... | PeriodConverter implements TypeConverter<Period> { @Override public Period fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); try { return value == null ? null : Period.parse(value); } catch (DateTimeParseException e) { throw new IllegalArgumentException(f... | PeriodConverter implements TypeConverter<Period> { @Override public Period fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); try { return value == null ? null : Period.parse(value); } catch (DateTimeParseException e) { throw new IllegalArgumentException(f... | PeriodConverter implements TypeConverter<Period> { @Override public Period fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); try { return value == null ? null : Period.parse(value); } catch (DateTimeParseException e) { throw new IllegalArgumentException(f... |
@Test public void shouldBeApplicableWhenLongType() { Type type = Long.class; boolean applicable = longTypeConverter.isApplicable(type, emptyMap()); assertThat(applicable).isTrue(); } | @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Long.class, Long.TYPE); } | LongConverter extends AbstractNumberConverter<Long> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Long.class, Long.TYPE); } } | LongConverter extends AbstractNumberConverter<Long> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Long.class, Long.TYPE); } } | LongConverter extends AbstractNumberConverter<Long> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Long.class, Long.TYPE); } @Override boolean isApplicable(Type type, Map<String, String> attributes); } | LongConverter extends AbstractNumberConverter<Long> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Long.class, Long.TYPE); } @Override boolean isApplicable(Type type, Map<String, String> attributes); } |
@Test public void shouldNotBeApplicableWhenNotLongType() { Type type = Boolean.class; boolean applicable = longTypeConverter.isApplicable(type, emptyMap()); assertThat(applicable).isFalse(); } | @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Long.class, Long.TYPE); } | LongConverter extends AbstractNumberConverter<Long> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Long.class, Long.TYPE); } } | LongConverter extends AbstractNumberConverter<Long> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Long.class, Long.TYPE); } } | LongConverter extends AbstractNumberConverter<Long> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Long.class, Long.TYPE); } @Override boolean isApplicable(Type type, Map<String, String> attributes); } | LongConverter extends AbstractNumberConverter<Long> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Long.class, Long.TYPE); } @Override boolean isApplicable(Type type, Map<String, String> attributes); } |
@Test public void shouldThrowExceptionWhenCheckingIfApplicableAndTypeIsNull() { assertThatThrownBy(() -> longTypeConverter.isApplicable(null, emptyMap())) .isExactlyInstanceOf(NullPointerException.class) .hasMessage("type cannot be null"); } | @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Long.class, Long.TYPE); } | LongConverter extends AbstractNumberConverter<Long> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Long.class, Long.TYPE); } } | LongConverter extends AbstractNumberConverter<Long> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Long.class, Long.TYPE); } } | LongConverter extends AbstractNumberConverter<Long> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Long.class, Long.TYPE); } @Override boolean isApplicable(Type type, Map<String, String> attributes); } | LongConverter extends AbstractNumberConverter<Long> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Long.class, Long.TYPE); } @Override boolean isApplicable(Type type, Map<String, String> attributes); } |
@Test public void shouldBeApplicableWhenOffsetDateTimeType() { Type type = OffsetDateTime.class; boolean applicable = offsetDateTimeConverter.isApplicable(type, emptyMap()); assertThat(applicable).isTrue(); } | @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && OffsetDateTime.class.isAssignableFrom((Class<?>) type); } | OffsetDateTimeConverter extends AbstractTemporalAccessorConverter<OffsetDateTime> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && OffsetDateTime.class.isAssignableFrom((Class<?>) type); } } | OffsetDateTimeConverter extends AbstractTemporalAccessorConverter<OffsetDateTime> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && OffsetDateTime.class.isAssignableFrom((Class<?>) type); } } | OffsetDateTimeConverter extends AbstractTemporalAccessorConverter<OffsetDateTime> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && OffsetDateTime.class.isAssignableFrom((Class<?>) type); } @Override bool... | OffsetDateTimeConverter extends AbstractTemporalAccessorConverter<OffsetDateTime> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && OffsetDateTime.class.isAssignableFrom((Class<?>) type); } @Override bool... |
@Test public void shouldReturnNullObjectForNullXML() { String resource = null; XmlRootConfiguration01 xmlRootConfiguration01 = (XmlRootConfiguration01) jaxbTypeConverter.fromString(XmlRootConfiguration01.class, resource, null); assertThat(xmlRootConfiguration01).isNull(); } | @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (isBlank(value)) { return null; } @SuppressWarnings("unchecked") Class<T> targetClazz = (Class<T>) type; JaxbPool jaxbPool = getJaxbPool(targetClazz); try (Handle<Unmarshaller> handle... | JaxbConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (isBlank(value)) { return null; } @SuppressWarnings("unchecked") Class<T> targetClazz = (Class<T>) type; JaxbPool jaxbPool = getJaxbPool(ta... | JaxbConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (isBlank(value)) { return null; } @SuppressWarnings("unchecked") Class<T> targetClazz = (Class<T>) type; JaxbPool jaxbPool = getJaxbPool(ta... | JaxbConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (isBlank(value)) { return null; } @SuppressWarnings("unchecked") Class<T> targetClazz = (Class<T>) type; JaxbPool jaxbPool = getJaxbPool(ta... | JaxbConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (isBlank(value)) { return null; } @SuppressWarnings("unchecked") Class<T> targetClazz = (Class<T>) type; JaxbPool jaxbPool = getJaxbPool(ta... |
@Test public void shouldNotBeApplicableWhenNotOffsetDateTimeType() { Type type = Boolean.class; boolean applicable = offsetDateTimeConverter.isApplicable(type, emptyMap()); assertThat(applicable).isFalse(); } | @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && OffsetDateTime.class.isAssignableFrom((Class<?>) type); } | OffsetDateTimeConverter extends AbstractTemporalAccessorConverter<OffsetDateTime> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && OffsetDateTime.class.isAssignableFrom((Class<?>) type); } } | OffsetDateTimeConverter extends AbstractTemporalAccessorConverter<OffsetDateTime> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && OffsetDateTime.class.isAssignableFrom((Class<?>) type); } } | OffsetDateTimeConverter extends AbstractTemporalAccessorConverter<OffsetDateTime> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && OffsetDateTime.class.isAssignableFrom((Class<?>) type); } @Override bool... | OffsetDateTimeConverter extends AbstractTemporalAccessorConverter<OffsetDateTime> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && OffsetDateTime.class.isAssignableFrom((Class<?>) type); } @Override bool... |
@Test public void shouldThrowExceptionWhenCheckingIfApplicableAndTypeIsNull() { assertThatThrownBy(() -> offsetDateTimeConverter.isApplicable(null, emptyMap())) .isExactlyInstanceOf(NullPointerException.class) .hasMessage("type cannot be null"); } | @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && OffsetDateTime.class.isAssignableFrom((Class<?>) type); } | OffsetDateTimeConverter extends AbstractTemporalAccessorConverter<OffsetDateTime> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && OffsetDateTime.class.isAssignableFrom((Class<?>) type); } } | OffsetDateTimeConverter extends AbstractTemporalAccessorConverter<OffsetDateTime> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && OffsetDateTime.class.isAssignableFrom((Class<?>) type); } } | OffsetDateTimeConverter extends AbstractTemporalAccessorConverter<OffsetDateTime> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && OffsetDateTime.class.isAssignableFrom((Class<?>) type); } @Override bool... | OffsetDateTimeConverter extends AbstractTemporalAccessorConverter<OffsetDateTime> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && OffsetDateTime.class.isAssignableFrom((Class<?>) type); } @Override bool... |
@Test public void shouldReadValuesFromStringWhenNotUnescaping() { String stringValue = "A"; Character value = converter.fromString(Character.class, stringValue, null); assertThat(value).isEqualTo('A'); } | @Override public Character fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null || value.isEmpty()) { return null; } if (value.length() == 1) { return value.charAt(0); } if (value.charAt(0) == '\\') { String unescapedValue; try { unescapedV... | CharacterConverter implements TypeConverter<Character> { @Override public Character fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null || value.isEmpty()) { return null; } if (value.length() == 1) { return value.charAt(0); } if (value.cha... | CharacterConverter implements TypeConverter<Character> { @Override public Character fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null || value.isEmpty()) { return null; } if (value.length() == 1) { return value.charAt(0); } if (value.cha... | CharacterConverter implements TypeConverter<Character> { @Override public Character fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null || value.isEmpty()) { return null; } if (value.length() == 1) { return value.charAt(0); } if (value.cha... | CharacterConverter implements TypeConverter<Character> { @Override public Character fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null || value.isEmpty()) { return null; } if (value.length() == 1) { return value.charAt(0); } if (value.cha... |
@Test public void shouldReadValuesFromStringWhenUnescaping() { String stringValue = "\\u0080"; Character value = converter.fromString(Character.class, stringValue, null); assertThat(value).isEqualTo('\u0080'); } | @Override public Character fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null || value.isEmpty()) { return null; } if (value.length() == 1) { return value.charAt(0); } if (value.charAt(0) == '\\') { String unescapedValue; try { unescapedV... | CharacterConverter implements TypeConverter<Character> { @Override public Character fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null || value.isEmpty()) { return null; } if (value.length() == 1) { return value.charAt(0); } if (value.cha... | CharacterConverter implements TypeConverter<Character> { @Override public Character fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null || value.isEmpty()) { return null; } if (value.length() == 1) { return value.charAt(0); } if (value.cha... | CharacterConverter implements TypeConverter<Character> { @Override public Character fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null || value.isEmpty()) { return null; } if (value.length() == 1) { return value.charAt(0); } if (value.cha... | CharacterConverter implements TypeConverter<Character> { @Override public Character fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null || value.isEmpty()) { return null; } if (value.length() == 1) { return value.charAt(0); } if (value.cha... |
@Test public void shouldThrowExceptionWhenReadingIllegalValuesFromString() { String stringValue = "longer then just on character string"; assertThrows(IllegalArgumentException.class, () -> converter.fromString(Character.class, stringValue, null), "Unable to convert to a Character: " + stringValue ); } | @Override public Character fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null || value.isEmpty()) { return null; } if (value.length() == 1) { return value.charAt(0); } if (value.charAt(0) == '\\') { String unescapedValue; try { unescapedV... | CharacterConverter implements TypeConverter<Character> { @Override public Character fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null || value.isEmpty()) { return null; } if (value.length() == 1) { return value.charAt(0); } if (value.cha... | CharacterConverter implements TypeConverter<Character> { @Override public Character fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null || value.isEmpty()) { return null; } if (value.length() == 1) { return value.charAt(0); } if (value.cha... | CharacterConverter implements TypeConverter<Character> { @Override public Character fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null || value.isEmpty()) { return null; } if (value.length() == 1) { return value.charAt(0); } if (value.cha... | CharacterConverter implements TypeConverter<Character> { @Override public Character fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null || value.isEmpty()) { return null; } if (value.length() == 1) { return value.charAt(0); } if (value.cha... |
@Test public void shouldWriteValueAsString() { Character value = 'A'; String asString = converter.toString(Character.class, value, null); assertThat(asString).isEqualTo("A"); } | @Override public String toString(Type type, Character value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : escapeJava(value.toString()); } | CharacterConverter implements TypeConverter<Character> { @Override public String toString(Type type, Character value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : escapeJava(value.toString()); } } | CharacterConverter implements TypeConverter<Character> { @Override public String toString(Type type, Character value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : escapeJava(value.toString()); } } | CharacterConverter implements TypeConverter<Character> { @Override public String toString(Type type, Character value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : escapeJava(value.toString()); } @Override boolean isApplicable(Type type, Map<String, String... | CharacterConverter implements TypeConverter<Character> { @Override public String toString(Type type, Character value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : escapeJava(value.toString()); } @Override boolean isApplicable(Type type, Map<String, String... |
@Test public void shouldConvertToNullFromNull() { Character value = null; String asString = converter.toString(Character.class, value, null); assertThat(asString).isNull(); } | @Override public String toString(Type type, Character value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : escapeJava(value.toString()); } | CharacterConverter implements TypeConverter<Character> { @Override public String toString(Type type, Character value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : escapeJava(value.toString()); } } | CharacterConverter implements TypeConverter<Character> { @Override public String toString(Type type, Character value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : escapeJava(value.toString()); } } | CharacterConverter implements TypeConverter<Character> { @Override public String toString(Type type, Character value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : escapeJava(value.toString()); } @Override boolean isApplicable(Type type, Map<String, String... | CharacterConverter implements TypeConverter<Character> { @Override public String toString(Type type, Character value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : escapeJava(value.toString()); } @Override boolean isApplicable(Type type, Map<String, String... |
@Test public void shouldConvertToNullFromEmptyString() { String stringValue = ""; Character value = converter.fromString(Character.class, stringValue, null); assertThat(value).isNull(); } | @Override public Character fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null || value.isEmpty()) { return null; } if (value.length() == 1) { return value.charAt(0); } if (value.charAt(0) == '\\') { String unescapedValue; try { unescapedV... | CharacterConverter implements TypeConverter<Character> { @Override public Character fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null || value.isEmpty()) { return null; } if (value.length() == 1) { return value.charAt(0); } if (value.cha... | CharacterConverter implements TypeConverter<Character> { @Override public Character fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null || value.isEmpty()) { return null; } if (value.length() == 1) { return value.charAt(0); } if (value.cha... | CharacterConverter implements TypeConverter<Character> { @Override public Character fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null || value.isEmpty()) { return null; } if (value.length() == 1) { return value.charAt(0); } if (value.cha... | CharacterConverter implements TypeConverter<Character> { @Override public Character fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null || value.isEmpty()) { return null; } if (value.length() == 1) { return value.charAt(0); } if (value.cha... |
@Test public void shouldUnescapeEscapedString() { Character value = '\u0080'; String asString = converter.toString(Character.class, value, null); assertThat(asString).isEqualTo("\\u0080"); } | @Override public String toString(Type type, Character value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : escapeJava(value.toString()); } | CharacterConverter implements TypeConverter<Character> { @Override public String toString(Type type, Character value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : escapeJava(value.toString()); } } | CharacterConverter implements TypeConverter<Character> { @Override public String toString(Type type, Character value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : escapeJava(value.toString()); } } | CharacterConverter implements TypeConverter<Character> { @Override public String toString(Type type, Character value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : escapeJava(value.toString()); } @Override boolean isApplicable(Type type, Map<String, String... | CharacterConverter implements TypeConverter<Character> { @Override public String toString(Type type, Character value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return value == null ? null : escapeJava(value.toString()); } @Override boolean isApplicable(Type type, Map<String, String... |
@Test public void shouldEscapedString() { String invalidEncodedCharacter = "\\u001"; assertThrows(IllegalArgumentException.class, () -> converter.fromString(Character.class, invalidEncodedCharacter, null), "Unable to convert to a Character: " + invalidEncodedCharacter ); } | @Override public Character fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null || value.isEmpty()) { return null; } if (value.length() == 1) { return value.charAt(0); } if (value.charAt(0) == '\\') { String unescapedValue; try { unescapedV... | CharacterConverter implements TypeConverter<Character> { @Override public Character fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null || value.isEmpty()) { return null; } if (value.length() == 1) { return value.charAt(0); } if (value.cha... | CharacterConverter implements TypeConverter<Character> { @Override public Character fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null || value.isEmpty()) { return null; } if (value.length() == 1) { return value.charAt(0); } if (value.cha... | CharacterConverter implements TypeConverter<Character> { @Override public Character fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null || value.isEmpty()) { return null; } if (value.length() == 1) { return value.charAt(0); } if (value.cha... | CharacterConverter implements TypeConverter<Character> { @Override public Character fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null || value.isEmpty()) { return null; } if (value.length() == 1) { return value.charAt(0); } if (value.cha... |
@Test public void shouldFailValidationWhenReadingXMLNotCompliantWithTheSchema() { String resource = loadXml("/JaxbTypeAdapterTest/XmlRootConfiguration01.invalid.xml"); assertThatThrownBy(() -> jaxbTypeConverter.fromString(XmlRootConfiguration01.class, resource, null)) .isInstanceOf(IllegalArgumentException.class); } | @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (isBlank(value)) { return null; } @SuppressWarnings("unchecked") Class<T> targetClazz = (Class<T>) type; JaxbPool jaxbPool = getJaxbPool(targetClazz); try (Handle<Unmarshaller> handle... | JaxbConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (isBlank(value)) { return null; } @SuppressWarnings("unchecked") Class<T> targetClazz = (Class<T>) type; JaxbPool jaxbPool = getJaxbPool(ta... | JaxbConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (isBlank(value)) { return null; } @SuppressWarnings("unchecked") Class<T> targetClazz = (Class<T>) type; JaxbPool jaxbPool = getJaxbPool(ta... | JaxbConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (isBlank(value)) { return null; } @SuppressWarnings("unchecked") Class<T> targetClazz = (Class<T>) type; JaxbPool jaxbPool = getJaxbPool(ta... | JaxbConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (isBlank(value)) { return null; } @SuppressWarnings("unchecked") Class<T> targetClazz = (Class<T>) type; JaxbPool jaxbPool = getJaxbPool(ta... |
@Test public void shouldBeApplicableToCharacter() { boolean applicable = converter.isApplicable(Character.class, null); assertThat(applicable).isTrue(); } | @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && (Character.class.isAssignableFrom((Class<?>) type) || Character.TYPE.isAssignableFrom((Class<?>) type)); } | CharacterConverter implements TypeConverter<Character> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && (Character.class.isAssignableFrom((Class<?>) type) || Character.TYPE.isAssignableFrom((Class<?>) typ... | CharacterConverter implements TypeConverter<Character> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && (Character.class.isAssignableFrom((Class<?>) type) || Character.TYPE.isAssignableFrom((Class<?>) typ... | CharacterConverter implements TypeConverter<Character> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && (Character.class.isAssignableFrom((Class<?>) type) || Character.TYPE.isAssignableFrom((Class<?>) typ... | CharacterConverter implements TypeConverter<Character> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && (Character.class.isAssignableFrom((Class<?>) type) || Character.TYPE.isAssignableFrom((Class<?>) typ... |
@Test public void shouldNotBeApplicableToNonCharacter() { boolean applicable = converter.isApplicable(Object.class, null); assertThat(applicable).isFalse(); } | @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && (Character.class.isAssignableFrom((Class<?>) type) || Character.TYPE.isAssignableFrom((Class<?>) type)); } | CharacterConverter implements TypeConverter<Character> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && (Character.class.isAssignableFrom((Class<?>) type) || Character.TYPE.isAssignableFrom((Class<?>) typ... | CharacterConverter implements TypeConverter<Character> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && (Character.class.isAssignableFrom((Class<?>) type) || Character.TYPE.isAssignableFrom((Class<?>) typ... | CharacterConverter implements TypeConverter<Character> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && (Character.class.isAssignableFrom((Class<?>) type) || Character.TYPE.isAssignableFrom((Class<?>) typ... | CharacterConverter implements TypeConverter<Character> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && (Character.class.isAssignableFrom((Class<?>) type) || Character.TYPE.isAssignableFrom((Class<?>) typ... |
@Test public void shouldConvertFromStringWhenFormatNotSpecified() { Duration duration = Duration.ofMillis(1260535L); Duration readDuration = converter.fromString(Duration.class, "PT21M0.535S", null); assertThat(readDuration).isEqualTo(duration); } | @Override public Duration fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) { try { SimpleDateFormat dateFormat = getDateFormat(format); LocalDateTime localDateTime ... | DurationConverter implements TypeConverter<Duration> { @Override public Duration fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) { try { SimpleDateFormat dateForma... | DurationConverter implements TypeConverter<Duration> { @Override public Duration fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) { try { SimpleDateFormat dateForma... | DurationConverter implements TypeConverter<Duration> { @Override public Duration fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) { try { SimpleDateFormat dateForma... | DurationConverter implements TypeConverter<Duration> { @Override public Duration fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) { try { SimpleDateFormat dateForma... |
@Test public void shouldConvertFromStringWhenFormatSpecified() { Duration duration = Duration.ofMillis(600000L); String format = "HH:mm:ss"; Map<String, String> attributes = singletonMap("format", format); Duration readDuration = converter.fromString(Duration.class, "00:10:00", attributes); assertThat(readDuration).isE... | @Override public Duration fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) { try { SimpleDateFormat dateFormat = getDateFormat(format); LocalDateTime localDateTime ... | DurationConverter implements TypeConverter<Duration> { @Override public Duration fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) { try { SimpleDateFormat dateForma... | DurationConverter implements TypeConverter<Duration> { @Override public Duration fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) { try { SimpleDateFormat dateForma... | DurationConverter implements TypeConverter<Duration> { @Override public Duration fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) { try { SimpleDateFormat dateForma... | DurationConverter implements TypeConverter<Duration> { @Override public Duration fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) { try { SimpleDateFormat dateForma... |
@Test public void shouldConvertToStringWhenFormatNotSpecified() { Duration duration = Duration.ofMillis(1260535L); String asString = converter.toString(Duration.class, duration, null); assertThat(asString).isEqualTo("PT21M0.535S"); } | @Override public String toString(Type type, Duration value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) { try { return formatDuration(value.toMillis(), format)... | DurationConverter implements TypeConverter<Duration> { @Override public String toString(Type type, Duration value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) ... | DurationConverter implements TypeConverter<Duration> { @Override public String toString(Type type, Duration value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) ... | DurationConverter implements TypeConverter<Duration> { @Override public String toString(Type type, Duration value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) ... | DurationConverter implements TypeConverter<Duration> { @Override public String toString(Type type, Duration value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) ... |
@Test public void shouldConvertToStringWhenFormatSpecified() { Duration duration = Duration.ofHours(1).plusMinutes(10).plusSeconds(20); String format = "HH:mm:ss"; Map<String, String> attributes = singletonMap("format", format); String asString = converter.toString(Duration.class, duration, attributes); assertThat(asSt... | @Override public String toString(Type type, Duration value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) { try { return formatDuration(value.toMillis(), format)... | DurationConverter implements TypeConverter<Duration> { @Override public String toString(Type type, Duration value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) ... | DurationConverter implements TypeConverter<Duration> { @Override public String toString(Type type, Duration value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) ... | DurationConverter implements TypeConverter<Duration> { @Override public String toString(Type type, Duration value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) ... | DurationConverter implements TypeConverter<Duration> { @Override public String toString(Type type, Duration value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) ... |
@Test public void shouldAcceptReadableDurationType() { Type type = Duration.class; boolean isApplicable = converter.isApplicable(type, null); assertThat(isApplicable).isTrue(); } | @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Duration.class.isAssignableFrom((Class<?>) type); } | DurationConverter implements TypeConverter<Duration> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Duration.class.isAssignableFrom((Class<?>) type); } } | DurationConverter implements TypeConverter<Duration> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Duration.class.isAssignableFrom((Class<?>) type); } } | DurationConverter implements TypeConverter<Duration> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Duration.class.isAssignableFrom((Class<?>) type); } @Override boolean isApplicable(Type type, Map<Str... | DurationConverter implements TypeConverter<Duration> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Duration.class.isAssignableFrom((Class<?>) type); } @Override boolean isApplicable(Type type, Map<Str... |
@Test public void shouldNotAcceptUnknownType() { boolean isApplicable = converter.isApplicable(mock(Type.class), null); assertThat(isApplicable).isFalse(); } | @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Duration.class.isAssignableFrom((Class<?>) type); } | DurationConverter implements TypeConverter<Duration> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Duration.class.isAssignableFrom((Class<?>) type); } } | DurationConverter implements TypeConverter<Duration> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Duration.class.isAssignableFrom((Class<?>) type); } } | DurationConverter implements TypeConverter<Duration> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Duration.class.isAssignableFrom((Class<?>) type); } @Override boolean isApplicable(Type type, Map<Str... | DurationConverter implements TypeConverter<Duration> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Duration.class.isAssignableFrom((Class<?>) type); } @Override boolean isApplicable(Type type, Map<Str... |
@Test public void shouldReturnNullWhenConvertingToStringAndValueToConvertIsNull() { String converted = converter.toString(Duration.class, null, null); assertThat(converted).isNull(); } | @Override public String toString(Type type, Duration value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) { try { return formatDuration(value.toMillis(), format)... | DurationConverter implements TypeConverter<Duration> { @Override public String toString(Type type, Duration value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) ... | DurationConverter implements TypeConverter<Duration> { @Override public String toString(Type type, Duration value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) ... | DurationConverter implements TypeConverter<Duration> { @Override public String toString(Type type, Duration value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) ... | DurationConverter implements TypeConverter<Duration> { @Override public String toString(Type type, Duration value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) ... |
@Test public void shouldThrowExceptionWhenConvertingFromStringAndWrongValueString() { String durationInString = "invalid value string"; assertThatThrownBy(() -> converter.fromString(Duration.class, durationInString, null)) .isExactlyInstanceOf(IllegalArgumentException.class) .hasMessageContaining("Unable to convert to ... | @Override public Duration fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) { try { SimpleDateFormat dateFormat = getDateFormat(format); LocalDateTime localDateTime ... | DurationConverter implements TypeConverter<Duration> { @Override public Duration fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) { try { SimpleDateFormat dateForma... | DurationConverter implements TypeConverter<Duration> { @Override public Duration fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) { try { SimpleDateFormat dateForma... | DurationConverter implements TypeConverter<Duration> { @Override public Duration fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) { try { SimpleDateFormat dateForma... | DurationConverter implements TypeConverter<Duration> { @Override public Duration fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) { try { SimpleDateFormat dateForma... |
@Test public void shouldReturnProperPojoForValidXML() { String resource = loadXml("/JaxbTypeAdapterTest/XmlRootConfiguration01.xml"); XmlRootConfiguration01 config01 = (XmlRootConfiguration01) jaxbTypeConverter.fromString(XmlRootConfiguration01.class, resource, null); assertThat(config01.getConfigurationName()).isEqual... | @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (isBlank(value)) { return null; } @SuppressWarnings("unchecked") Class<T> targetClazz = (Class<T>) type; JaxbPool jaxbPool = getJaxbPool(targetClazz); try (Handle<Unmarshaller> handle... | JaxbConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (isBlank(value)) { return null; } @SuppressWarnings("unchecked") Class<T> targetClazz = (Class<T>) type; JaxbPool jaxbPool = getJaxbPool(ta... | JaxbConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (isBlank(value)) { return null; } @SuppressWarnings("unchecked") Class<T> targetClazz = (Class<T>) type; JaxbPool jaxbPool = getJaxbPool(ta... | JaxbConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (isBlank(value)) { return null; } @SuppressWarnings("unchecked") Class<T> targetClazz = (Class<T>) type; JaxbPool jaxbPool = getJaxbPool(ta... | JaxbConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (isBlank(value)) { return null; } @SuppressWarnings("unchecked") Class<T> targetClazz = (Class<T>) type; JaxbPool jaxbPool = getJaxbPool(ta... |
@Test public void shouldThrowExceptionWhenConvertingFromStringWithFormatAndWrongValueString() { String durationInString = "invalid value string"; String format = "H:i:s"; Map<String, String> attributes = singletonMap("format", format); assertThatThrownBy(() -> converter.fromString(Duration.class, durationInString, attr... | @Override public Duration fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) { try { SimpleDateFormat dateFormat = getDateFormat(format); LocalDateTime localDateTime ... | DurationConverter implements TypeConverter<Duration> { @Override public Duration fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) { try { SimpleDateFormat dateForma... | DurationConverter implements TypeConverter<Duration> { @Override public Duration fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) { try { SimpleDateFormat dateForma... | DurationConverter implements TypeConverter<Duration> { @Override public Duration fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) { try { SimpleDateFormat dateForma... | DurationConverter implements TypeConverter<Duration> { @Override public Duration fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) { try { SimpleDateFormat dateForma... |
@Test public void shouldThrowExceptionWhenConvertingFromStringWithFormatAndWrongValue() { String durationInString = "a wrong duration"; String format = "HH:mm:ss"; Map<String, String> attributes = singletonMap("format", format); assertThatThrownBy(() -> converter.fromString(Duration.class, durationInString, attributes)... | @Override public Duration fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) { try { SimpleDateFormat dateFormat = getDateFormat(format); LocalDateTime localDateTime ... | DurationConverter implements TypeConverter<Duration> { @Override public Duration fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) { try { SimpleDateFormat dateForma... | DurationConverter implements TypeConverter<Duration> { @Override public Duration fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) { try { SimpleDateFormat dateForma... | DurationConverter implements TypeConverter<Duration> { @Override public Duration fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) { try { SimpleDateFormat dateForma... | DurationConverter implements TypeConverter<Duration> { @Override public Duration fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) { try { SimpleDateFormat dateForma... |
@Test public void shouldThrowExceptionWhenConvertingToStringWithFormatAndWrongValue() { Duration duration = Duration.ofMillis(-600000L); String format = "HH:mm:ss"; Map<String, String> attributes = singletonMap("format", format); assertThatThrownBy(() -> converter.toString(Duration.class, duration, attributes)) .isExac... | @Override public String toString(Type type, Duration value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) { try { return formatDuration(value.toMillis(), format)... | DurationConverter implements TypeConverter<Duration> { @Override public String toString(Type type, Duration value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) ... | DurationConverter implements TypeConverter<Duration> { @Override public String toString(Type type, Duration value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) ... | DurationConverter implements TypeConverter<Duration> { @Override public String toString(Type type, Duration value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) ... | DurationConverter implements TypeConverter<Duration> { @Override public String toString(Type type, Duration value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (value == null) { return null; } String format = (attributes == null) ? null : attributes.get(FORMAT); if (format != null) ... |
@Test public void shouldBeApplicableWhenByteType() { Type type = Byte.class; boolean applicable = converter.isApplicable(type, emptyMap()); assertThat(applicable).isTrue(); } | @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Byte.class, Byte.TYPE); } | ByteConverter extends AbstractNumberConverter<Byte> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Byte.class, Byte.TYPE); } } | ByteConverter extends AbstractNumberConverter<Byte> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Byte.class, Byte.TYPE); } } | ByteConverter extends AbstractNumberConverter<Byte> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Byte.class, Byte.TYPE); } @Override boolean isApplicable(Type type, Map<String, String> attributes); } | ByteConverter extends AbstractNumberConverter<Byte> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Byte.class, Byte.TYPE); } @Override boolean isApplicable(Type type, Map<String, String> attributes); } |
@Test public void shouldNotBeApplicableWhenNotByteType() { Type type = Boolean.class; boolean applicable = converter.isApplicable(type, emptyMap()); assertThat(applicable).isFalse(); } | @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Byte.class, Byte.TYPE); } | ByteConverter extends AbstractNumberConverter<Byte> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Byte.class, Byte.TYPE); } } | ByteConverter extends AbstractNumberConverter<Byte> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Byte.class, Byte.TYPE); } } | ByteConverter extends AbstractNumberConverter<Byte> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Byte.class, Byte.TYPE); } @Override boolean isApplicable(Type type, Map<String, String> attributes); } | ByteConverter extends AbstractNumberConverter<Byte> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Byte.class, Byte.TYPE); } @Override boolean isApplicable(Type type, Map<String, String> attributes); } |
@Test public void shouldThrowExceptionWhenCheckingIfApplicableAndTypeIsNull() { assertThatThrownBy(() -> converter.isApplicable(null, emptyMap())) .isExactlyInstanceOf(NullPointerException.class) .hasMessage("type cannot be null"); } | @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Byte.class, Byte.TYPE); } | ByteConverter extends AbstractNumberConverter<Byte> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Byte.class, Byte.TYPE); } } | ByteConverter extends AbstractNumberConverter<Byte> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Byte.class, Byte.TYPE); } } | ByteConverter extends AbstractNumberConverter<Byte> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Byte.class, Byte.TYPE); } @Override boolean isApplicable(Type type, Map<String, String> attributes); } | ByteConverter extends AbstractNumberConverter<Byte> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Byte.class, Byte.TYPE); } @Override boolean isApplicable(Type type, Map<String, String> attributes); } |
@Test public void shouldBeApplicableWhenLocalDateTimeType() { Type type = LocalDateTime.class; boolean applicable = localDateTimeTypeConverter.isApplicable(type, emptyMap()); assertThat(applicable).isTrue(); } | @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && LocalDateTime.class.isAssignableFrom((Class<?>) type); } | LocalDateTimeConverter extends AbstractTemporalAccessorConverter<LocalDateTime> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && LocalDateTime.class.isAssignableFrom((Class<?>) type); } } | LocalDateTimeConverter extends AbstractTemporalAccessorConverter<LocalDateTime> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && LocalDateTime.class.isAssignableFrom((Class<?>) type); } } | LocalDateTimeConverter extends AbstractTemporalAccessorConverter<LocalDateTime> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && LocalDateTime.class.isAssignableFrom((Class<?>) type); } @Override boolean... | LocalDateTimeConverter extends AbstractTemporalAccessorConverter<LocalDateTime> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && LocalDateTime.class.isAssignableFrom((Class<?>) type); } @Override boolean... |
@Test public void shouldNotBeApplicableWhenNotLocalDateTimeType() { Type type = Boolean.class; boolean applicable = localDateTimeTypeConverter.isApplicable(type, emptyMap()); assertThat(applicable).isFalse(); } | @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && LocalDateTime.class.isAssignableFrom((Class<?>) type); } | LocalDateTimeConverter extends AbstractTemporalAccessorConverter<LocalDateTime> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && LocalDateTime.class.isAssignableFrom((Class<?>) type); } } | LocalDateTimeConverter extends AbstractTemporalAccessorConverter<LocalDateTime> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && LocalDateTime.class.isAssignableFrom((Class<?>) type); } } | LocalDateTimeConverter extends AbstractTemporalAccessorConverter<LocalDateTime> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && LocalDateTime.class.isAssignableFrom((Class<?>) type); } @Override boolean... | LocalDateTimeConverter extends AbstractTemporalAccessorConverter<LocalDateTime> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && LocalDateTime.class.isAssignableFrom((Class<?>) type); } @Override boolean... |
@Test public void shouldThrowExceptionWhenCheckingIfApplicableAndTypeIsNull() { assertThatThrownBy(() -> localDateTimeTypeConverter.isApplicable(null, emptyMap())) .isExactlyInstanceOf(NullPointerException.class) .hasMessage("type cannot be null"); } | @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && LocalDateTime.class.isAssignableFrom((Class<?>) type); } | LocalDateTimeConverter extends AbstractTemporalAccessorConverter<LocalDateTime> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && LocalDateTime.class.isAssignableFrom((Class<?>) type); } } | LocalDateTimeConverter extends AbstractTemporalAccessorConverter<LocalDateTime> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && LocalDateTime.class.isAssignableFrom((Class<?>) type); } } | LocalDateTimeConverter extends AbstractTemporalAccessorConverter<LocalDateTime> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && LocalDateTime.class.isAssignableFrom((Class<?>) type); } @Override boolean... | LocalDateTimeConverter extends AbstractTemporalAccessorConverter<LocalDateTime> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && LocalDateTime.class.isAssignableFrom((Class<?>) type); } @Override boolean... |
@Test public void shouldBeApplicableToBigDecimal() { boolean applicable = converter.isApplicable(BigDecimal.class, null); assertThat(applicable).isTrue(); } | @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, BigDecimal.class, null); } | BigDecimalConverter extends AbstractNumberConverter<BigDecimal> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, BigDecimal.class, null); } } | BigDecimalConverter extends AbstractNumberConverter<BigDecimal> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, BigDecimal.class, null); } } | BigDecimalConverter extends AbstractNumberConverter<BigDecimal> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, BigDecimal.class, null); } @Override boolean isApplicable(Type type, Map<String, String> attributes); } | BigDecimalConverter extends AbstractNumberConverter<BigDecimal> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, BigDecimal.class, null); } @Override boolean isApplicable(Type type, Map<String, String> attributes); } |
@Test public void shouldReturnProperPojoForSecondValidXML() { String resource = loadXml("/JaxbTypeAdapterTest/XmlRootConfiguration02.xml"); XmlRootConfiguration02 config01 = (XmlRootConfiguration02) jaxbTypeConverter.fromString(XmlRootConfiguration02.class, resource, null); assertThat(config01.getConfigurationName()).i... | @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (isBlank(value)) { return null; } @SuppressWarnings("unchecked") Class<T> targetClazz = (Class<T>) type; JaxbPool jaxbPool = getJaxbPool(targetClazz); try (Handle<Unmarshaller> handle... | JaxbConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (isBlank(value)) { return null; } @SuppressWarnings("unchecked") Class<T> targetClazz = (Class<T>) type; JaxbPool jaxbPool = getJaxbPool(ta... | JaxbConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (isBlank(value)) { return null; } @SuppressWarnings("unchecked") Class<T> targetClazz = (Class<T>) type; JaxbPool jaxbPool = getJaxbPool(ta... | JaxbConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (isBlank(value)) { return null; } @SuppressWarnings("unchecked") Class<T> targetClazz = (Class<T>) type; JaxbPool jaxbPool = getJaxbPool(ta... | JaxbConverter implements TypeConverter<T> { @Override public T fromString(Type type, String value, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); if (isBlank(value)) { return null; } @SuppressWarnings("unchecked") Class<T> targetClazz = (Class<T>) type; JaxbPool jaxbPool = getJaxbPool(ta... |
@Test public void shouldNotBeApplicableToNonBigDecimal() { boolean applicable = converter.isApplicable(Object.class, null); assertThat(applicable).isFalse(); } | @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, BigDecimal.class, null); } | BigDecimalConverter extends AbstractNumberConverter<BigDecimal> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, BigDecimal.class, null); } } | BigDecimalConverter extends AbstractNumberConverter<BigDecimal> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, BigDecimal.class, null); } } | BigDecimalConverter extends AbstractNumberConverter<BigDecimal> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, BigDecimal.class, null); } @Override boolean isApplicable(Type type, Map<String, String> attributes); } | BigDecimalConverter extends AbstractNumberConverter<BigDecimal> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, BigDecimal.class, null); } @Override boolean isApplicable(Type type, Map<String, String> attributes); } |
@Test public void shouldBeApplicableWhenIntegerType() { Type type = Integer.class; boolean applicable = converter.isApplicable(type, emptyMap()); assertThat(applicable).isTrue(); } | @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Integer.class, Integer.TYPE); } | IntegerConverter extends AbstractNumberConverter<Integer> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Integer.class, Integer.TYPE); } } | IntegerConverter extends AbstractNumberConverter<Integer> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Integer.class, Integer.TYPE); } } | IntegerConverter extends AbstractNumberConverter<Integer> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Integer.class, Integer.TYPE); } @Override boolean isApplicable(Type type, Map<String, String> attributes); } | IntegerConverter extends AbstractNumberConverter<Integer> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Integer.class, Integer.TYPE); } @Override boolean isApplicable(Type type, Map<String, String> attributes); } |
@Test public void shouldNotBeApplicableWhenNotIntegerType() { Type type = Boolean.class; boolean applicable = converter.isApplicable(type, emptyMap()); assertThat(applicable).isFalse(); } | @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Integer.class, Integer.TYPE); } | IntegerConverter extends AbstractNumberConverter<Integer> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Integer.class, Integer.TYPE); } } | IntegerConverter extends AbstractNumberConverter<Integer> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Integer.class, Integer.TYPE); } } | IntegerConverter extends AbstractNumberConverter<Integer> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Integer.class, Integer.TYPE); } @Override boolean isApplicable(Type type, Map<String, String> attributes); } | IntegerConverter extends AbstractNumberConverter<Integer> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Integer.class, Integer.TYPE); } @Override boolean isApplicable(Type type, Map<String, String> attributes); } |
@Test public void shouldThrowExceptionWhenCheckingIfApplicableAndTypeIsNull() { assertThatThrownBy(() -> converter.isApplicable(null, emptyMap())) .isExactlyInstanceOf(NullPointerException.class) .hasMessage("type cannot be null"); } | @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Integer.class, Integer.TYPE); } | IntegerConverter extends AbstractNumberConverter<Integer> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Integer.class, Integer.TYPE); } } | IntegerConverter extends AbstractNumberConverter<Integer> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Integer.class, Integer.TYPE); } } | IntegerConverter extends AbstractNumberConverter<Integer> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Integer.class, Integer.TYPE); } @Override boolean isApplicable(Type type, Map<String, String> attributes); } | IntegerConverter extends AbstractNumberConverter<Integer> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Integer.class, Integer.TYPE); } @Override boolean isApplicable(Type type, Map<String, String> attributes); } |
@Test public void shouldBeApplicableWhenDoubleType() { Type type = Double.class; boolean applicable = doubleTypeConverter.isApplicable(type, emptyMap()); assertThat(applicable).isTrue(); } | @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Double.class, Double.TYPE); } | DoubleConverter extends AbstractNumberConverter<Double> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Double.class, Double.TYPE); } } | DoubleConverter extends AbstractNumberConverter<Double> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Double.class, Double.TYPE); } } | DoubleConverter extends AbstractNumberConverter<Double> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Double.class, Double.TYPE); } @Override boolean isApplicable(Type type, Map<String, String> attributes); } | DoubleConverter extends AbstractNumberConverter<Double> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Double.class, Double.TYPE); } @Override boolean isApplicable(Type type, Map<String, String> attributes); } |
@Test public void shouldNotBeApplicableWhenNotDoubleType() { Type type = Boolean.class; boolean applicable = doubleTypeConverter.isApplicable(type, emptyMap()); assertThat(applicable).isFalse(); } | @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Double.class, Double.TYPE); } | DoubleConverter extends AbstractNumberConverter<Double> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Double.class, Double.TYPE); } } | DoubleConverter extends AbstractNumberConverter<Double> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Double.class, Double.TYPE); } } | DoubleConverter extends AbstractNumberConverter<Double> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Double.class, Double.TYPE); } @Override boolean isApplicable(Type type, Map<String, String> attributes); } | DoubleConverter extends AbstractNumberConverter<Double> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Double.class, Double.TYPE); } @Override boolean isApplicable(Type type, Map<String, String> attributes); } |
@Test public void shouldThrowExceptionWhenCheckingIfApplicableAndTypeIsNull() { assertThatThrownBy(() -> doubleTypeConverter.isApplicable(null, emptyMap())) .isExactlyInstanceOf(NullPointerException.class) .hasMessage("type cannot be null"); } | @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Double.class, Double.TYPE); } | DoubleConverter extends AbstractNumberConverter<Double> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Double.class, Double.TYPE); } } | DoubleConverter extends AbstractNumberConverter<Double> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Double.class, Double.TYPE); } } | DoubleConverter extends AbstractNumberConverter<Double> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Double.class, Double.TYPE); } @Override boolean isApplicable(Type type, Map<String, String> attributes); } | DoubleConverter extends AbstractNumberConverter<Double> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { return isApplicable(type, Double.class, Double.TYPE); } @Override boolean isApplicable(Type type, Map<String, String> attributes); } |
@Test public void shouldBeApplicableWhenCurrencyType() { Type type = Currency.class; boolean applicable = converter.isApplicable(type, emptyMap()); assertThat(applicable).isTrue(); } | @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Currency.class.isAssignableFrom((Class<?>) type); } | CurrencyConverter implements TypeConverter<Currency> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Currency.class.isAssignableFrom((Class<?>) type); } } | CurrencyConverter implements TypeConverter<Currency> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Currency.class.isAssignableFrom((Class<?>) type); } } | CurrencyConverter implements TypeConverter<Currency> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Currency.class.isAssignableFrom((Class<?>) type); } @Override boolean isApplicable(Type type, Map<Str... | CurrencyConverter implements TypeConverter<Currency> { @Override public boolean isApplicable(Type type, Map<String, String> attributes) { requireNonNull(type, "type cannot be null"); return type instanceof Class<?> && Currency.class.isAssignableFrom((Class<?>) type); } @Override boolean isApplicable(Type type, Map<Str... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.