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 public void onStringProtectedSetWithMutatorsShouldThrowException() { Bean bean = new Bean(); expectedException.expect(PropertyException.class); PropertyUtils.setProperty(bean, "protectedProperty", null); }
public static void setProperty(Object bean, String field, Object value) { INSTANCE.checkParameters(bean, field); try { INSTANCE.setPropertyValue(bean, field, value); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), field, e); } }
PropertyUtils { public static void setProperty(Object bean, String field, Object value) { INSTANCE.checkParameters(bean, field); try { INSTANCE.setPropertyValue(bean, field, value); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), ...
PropertyUtils { public static void setProperty(Object bean, String field, Object value) { INSTANCE.checkParameters(bean, field); try { INSTANCE.setPropertyValue(bean, field, value); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), ...
PropertyUtils { public static void setProperty(Object bean, String field, Object value) { INSTANCE.checkParameters(bean, field); try { INSTANCE.setPropertyValue(bean, field, value); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), ...
PropertyUtils { public static void setProperty(Object bean, String field, Object value) { INSTANCE.checkParameters(bean, field); try { INSTANCE.setPropertyValue(bean, field, value); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), ...
@Test public void onInheritedStringPrivateWithMutatorsShouldSetValue() { Bean bean = new ChildBean(); PropertyUtils.setProperty(bean, "privatePropertyWithMutators", "value"); assertThat(bean.getPrivatePropertyWithMutators()).isEqualTo("value"); }
public static void setProperty(Object bean, String field, Object value) { INSTANCE.checkParameters(bean, field); try { INSTANCE.setPropertyValue(bean, field, value); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), field, e); } }
PropertyUtils { public static void setProperty(Object bean, String field, Object value) { INSTANCE.checkParameters(bean, field); try { INSTANCE.setPropertyValue(bean, field, value); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), ...
PropertyUtils { public static void setProperty(Object bean, String field, Object value) { INSTANCE.checkParameters(bean, field); try { INSTANCE.setPropertyValue(bean, field, value); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), ...
PropertyUtils { public static void setProperty(Object bean, String field, Object value) { INSTANCE.checkParameters(bean, field); try { INSTANCE.setPropertyValue(bean, field, value); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), ...
PropertyUtils { public static void setProperty(Object bean, String field, Object value) { INSTANCE.checkParameters(bean, field); try { INSTANCE.setPropertyValue(bean, field, value); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), ...
@Test public void onNonExistingPropertyShouldThrowException() { Bean bean = new Bean(); expectedException.expect(PropertyException.class); PropertyUtils.getProperty(bean, "nonExistingProperty"); }
public static Object getProperty(Object bean, String field) { INSTANCE.checkParameters(bean, field); try { return INSTANCE.getPropertyValue(bean, field); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), field, e); } }
PropertyUtils { public static Object getProperty(Object bean, String field) { INSTANCE.checkParameters(bean, field); try { return INSTANCE.getPropertyValue(bean, field); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), field, e); }...
PropertyUtils { public static Object getProperty(Object bean, String field) { INSTANCE.checkParameters(bean, field); try { return INSTANCE.getPropertyValue(bean, field); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), field, e); }...
PropertyUtils { public static Object getProperty(Object bean, String field) { INSTANCE.checkParameters(bean, field); try { return INSTANCE.getPropertyValue(bean, field); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), field, e); }...
PropertyUtils { public static Object getProperty(Object bean, String field) { INSTANCE.checkParameters(bean, field); try { return INSTANCE.getPropertyValue(bean, field); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), field, e); }...
@Test public void onFieldListShouldSetValue() { FieldListTest bean = new FieldListTest(); List<String> value = Collections.singletonList("asd"); PropertyUtils.setProperty(bean, "property", value); assertThat(bean.property).isEqualTo(value); }
public static void setProperty(Object bean, String field, Object value) { INSTANCE.checkParameters(bean, field); try { INSTANCE.setPropertyValue(bean, field, value); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), field, e); } }
PropertyUtils { public static void setProperty(Object bean, String field, Object value) { INSTANCE.checkParameters(bean, field); try { INSTANCE.setPropertyValue(bean, field, value); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), ...
PropertyUtils { public static void setProperty(Object bean, String field, Object value) { INSTANCE.checkParameters(bean, field); try { INSTANCE.setPropertyValue(bean, field, value); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), ...
PropertyUtils { public static void setProperty(Object bean, String field, Object value) { INSTANCE.checkParameters(bean, field); try { INSTANCE.setPropertyValue(bean, field, value); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), ...
PropertyUtils { public static void setProperty(Object bean, String field, Object value) { INSTANCE.checkParameters(bean, field); try { INSTANCE.setPropertyValue(bean, field, value); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), ...
@Test public void onFieldSetShouldSetValue() { FieldSetTest bean = new FieldSetTest(); Set<String> value = Collections.singleton("asd"); PropertyUtils.setProperty(bean, "property", value); assertThat(bean.property).isEqualTo(value); }
public static void setProperty(Object bean, String field, Object value) { INSTANCE.checkParameters(bean, field); try { INSTANCE.setPropertyValue(bean, field, value); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), field, e); } }
PropertyUtils { public static void setProperty(Object bean, String field, Object value) { INSTANCE.checkParameters(bean, field); try { INSTANCE.setPropertyValue(bean, field, value); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), ...
PropertyUtils { public static void setProperty(Object bean, String field, Object value) { INSTANCE.checkParameters(bean, field); try { INSTANCE.setPropertyValue(bean, field, value); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), ...
PropertyUtils { public static void setProperty(Object bean, String field, Object value) { INSTANCE.checkParameters(bean, field); try { INSTANCE.setPropertyValue(bean, field, value); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), ...
PropertyUtils { public static void setProperty(Object bean, String field, Object value) { INSTANCE.checkParameters(bean, field); try { INSTANCE.setPropertyValue(bean, field, value); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), ...
@Test public void onFieldWithThrowingUncheckedExceptionGetterShouldThrowException() { Bean bean = new Bean(); expectedException.expect(IllegalStateException.class); PropertyUtils.getProperty(bean, "uncheckedExceptionalField"); }
public static Object getProperty(Object bean, String field) { INSTANCE.checkParameters(bean, field); try { return INSTANCE.getPropertyValue(bean, field); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), field, e); } }
PropertyUtils { public static Object getProperty(Object bean, String field) { INSTANCE.checkParameters(bean, field); try { return INSTANCE.getPropertyValue(bean, field); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), field, e); }...
PropertyUtils { public static Object getProperty(Object bean, String field) { INSTANCE.checkParameters(bean, field); try { return INSTANCE.getPropertyValue(bean, field); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), field, e); }...
PropertyUtils { public static Object getProperty(Object bean, String field) { INSTANCE.checkParameters(bean, field); try { return INSTANCE.getPropertyValue(bean, field); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), field, e); }...
PropertyUtils { public static Object getProperty(Object bean, String field) { INSTANCE.checkParameters(bean, field); try { return INSTANCE.getPropertyValue(bean, field); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), field, e); }...
@Test public void onFieldWithThrowingUncheckedExceptionSetterShouldThrowException() { Bean bean = new Bean(); expectedException.expect(IllegalStateException.class); PropertyUtils.setProperty(bean, "uncheckedExceptionalField", "value"); }
public static void setProperty(Object bean, String field, Object value) { INSTANCE.checkParameters(bean, field); try { INSTANCE.setPropertyValue(bean, field, value); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), field, e); } }
PropertyUtils { public static void setProperty(Object bean, String field, Object value) { INSTANCE.checkParameters(bean, field); try { INSTANCE.setPropertyValue(bean, field, value); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), ...
PropertyUtils { public static void setProperty(Object bean, String field, Object value) { INSTANCE.checkParameters(bean, field); try { INSTANCE.setPropertyValue(bean, field, value); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), ...
PropertyUtils { public static void setProperty(Object bean, String field, Object value) { INSTANCE.checkParameters(bean, field); try { INSTANCE.setPropertyValue(bean, field, value); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), ...
PropertyUtils { public static void setProperty(Object bean, String field, Object value) { INSTANCE.checkParameters(bean, field); try { INSTANCE.setPropertyValue(bean, field, value); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), ...
@Test public void onFieldWithThrowingCheckedExceptionGetterShouldThrowException() { Bean bean = new Bean(); expectedException.expect(PropertyException.class); PropertyUtils.getProperty(bean, "PropertyException"); }
public static Object getProperty(Object bean, String field) { INSTANCE.checkParameters(bean, field); try { return INSTANCE.getPropertyValue(bean, field); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), field, e); } }
PropertyUtils { public static Object getProperty(Object bean, String field) { INSTANCE.checkParameters(bean, field); try { return INSTANCE.getPropertyValue(bean, field); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), field, e); }...
PropertyUtils { public static Object getProperty(Object bean, String field) { INSTANCE.checkParameters(bean, field); try { return INSTANCE.getPropertyValue(bean, field); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), field, e); }...
PropertyUtils { public static Object getProperty(Object bean, String field) { INSTANCE.checkParameters(bean, field); try { return INSTANCE.getPropertyValue(bean, field); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), field, e); }...
PropertyUtils { public static Object getProperty(Object bean, String field) { INSTANCE.checkParameters(bean, field); try { return INSTANCE.getPropertyValue(bean, field); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), field, e); }...
@Test public void onFieldWithThrowingCheckedExceptionSetterShouldThrowException() { Bean bean = new Bean(); expectedException.expect(PropertyException.class); PropertyUtils.setProperty(bean, "checkedExceptionalField", "value"); }
public static void setProperty(Object bean, String field, Object value) { INSTANCE.checkParameters(bean, field); try { INSTANCE.setPropertyValue(bean, field, value); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), field, e); } }
PropertyUtils { public static void setProperty(Object bean, String field, Object value) { INSTANCE.checkParameters(bean, field); try { INSTANCE.setPropertyValue(bean, field, value); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), ...
PropertyUtils { public static void setProperty(Object bean, String field, Object value) { INSTANCE.checkParameters(bean, field); try { INSTANCE.setPropertyValue(bean, field, value); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), ...
PropertyUtils { public static void setProperty(Object bean, String field, Object value) { INSTANCE.checkParameters(bean, field); try { INSTANCE.setPropertyValue(bean, field, value); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), ...
PropertyUtils { public static void setProperty(Object bean, String field, Object value) { INSTANCE.checkParameters(bean, field); try { INSTANCE.setPropertyValue(bean, field, value); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), ...
@Test public void unknownPropertyThrowingException() { Bean bean = new Bean(); expectedException.expect(PropertyException.class); PropertyUtils.setProperty(bean, "attrThatDoesNotExist", "value"); }
public static void setProperty(Object bean, String field, Object value) { INSTANCE.checkParameters(bean, field); try { INSTANCE.setPropertyValue(bean, field, value); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), field, e); } }
PropertyUtils { public static void setProperty(Object bean, String field, Object value) { INSTANCE.checkParameters(bean, field); try { INSTANCE.setPropertyValue(bean, field, value); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), ...
PropertyUtils { public static void setProperty(Object bean, String field, Object value) { INSTANCE.checkParameters(bean, field); try { INSTANCE.setPropertyValue(bean, field, value); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), ...
PropertyUtils { public static void setProperty(Object bean, String field, Object value) { INSTANCE.checkParameters(bean, field); try { INSTANCE.setPropertyValue(bean, field, value); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), ...
PropertyUtils { public static void setProperty(Object bean, String field, Object value) { INSTANCE.checkParameters(bean, field); try { INSTANCE.setPropertyValue(bean, field, value); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), ...
@Test(expected = UnsupportedOperationException.class) public void testMethodNotSupported() { upsert.getHttpMethod(); }
@Override protected HttpMethod getHttpMethod() { throw new UnsupportedOperationException(); }
ClientResourceUpsert extends ResourceUpsert { @Override protected HttpMethod getHttpMethod() { throw new UnsupportedOperationException(); } }
ClientResourceUpsert extends ResourceUpsert { @Override protected HttpMethod getHttpMethod() { throw new UnsupportedOperationException(); } ClientResourceUpsert(ClientProxyFactory proxyFactory); }
ClientResourceUpsert extends ResourceUpsert { @Override protected HttpMethod getHttpMethod() { throw new UnsupportedOperationException(); } ClientResourceUpsert(ClientProxyFactory proxyFactory); String getUID(ResourceIdentifier id); String getUID(RegistryEntry entry, Serializable id); void setRelations(List<Resource> r...
ClientResourceUpsert extends ResourceUpsert { @Override protected HttpMethod getHttpMethod() { throw new UnsupportedOperationException(); } ClientResourceUpsert(ClientProxyFactory proxyFactory); String getUID(ResourceIdentifier id); String getUID(RegistryEntry entry, Serializable id); void setRelations(List<Resource> r...
@Test public void unknownPropertyClassThrowingException() { expectedException.expect(PropertyException.class); PropertyUtils.getPropertyClass(Bean.class, "attrThatDoesNotExist"); }
public static Class<?> getPropertyClass(Class<?> beanClass, String field) { return INSTANCE.findPropertyClass(beanClass, field); }
PropertyUtils { public static Class<?> getPropertyClass(Class<?> beanClass, String field) { return INSTANCE.findPropertyClass(beanClass, field); } }
PropertyUtils { public static Class<?> getPropertyClass(Class<?> beanClass, String field) { return INSTANCE.findPropertyClass(beanClass, field); } private PropertyUtils(); }
PropertyUtils { public static Class<?> getPropertyClass(Class<?> beanClass, String field) { return INSTANCE.findPropertyClass(beanClass, field); } private PropertyUtils(); static Object getProperty(Object bean, String field); static Class<?> getPropertyClass(Class<?> beanClass, String field); static Type getPropertyTy...
PropertyUtils { public static Class<?> getPropertyClass(Class<?> beanClass, String field) { return INSTANCE.findPropertyClass(beanClass, field); } private PropertyUtils(); static Object getProperty(Object bean, String field); static Class<?> getPropertyClass(Class<?> beanClass, String field); static Type getPropertyTy...
@Test public void unknownPropertyTypeThrowingException() { expectedException.expect(PropertyException.class); PropertyUtils.getPropertyType(Bean.class, "attrThatDoesNotExist"); }
public static Type getPropertyType(Class<?> beanClass, String field) { return INSTANCE.findPropertyType(beanClass, field); }
PropertyUtils { public static Type getPropertyType(Class<?> beanClass, String field) { return INSTANCE.findPropertyType(beanClass, field); } }
PropertyUtils { public static Type getPropertyType(Class<?> beanClass, String field) { return INSTANCE.findPropertyType(beanClass, field); } private PropertyUtils(); }
PropertyUtils { public static Type getPropertyType(Class<?> beanClass, String field) { return INSTANCE.findPropertyType(beanClass, field); } private PropertyUtils(); static Object getProperty(Object bean, String field); static Class<?> getPropertyClass(Class<?> beanClass, String field); static Type getPropertyType(Cla...
PropertyUtils { public static Type getPropertyType(Class<?> beanClass, String field) { return INSTANCE.findPropertyType(beanClass, field); } private PropertyUtils(); static Object getProperty(Object bean, String field); static Class<?> getPropertyClass(Class<?> beanClass, String field); static Type getPropertyType(Cla...
@Test public void nullBeanResultsInNullValue() { Bean bean = null; Object result = PropertyUtils.getProperty(bean, Arrays.asList("publicProperty")); assertThat(result).isNull(); }
public static Object getProperty(Object bean, String field) { INSTANCE.checkParameters(bean, field); try { return INSTANCE.getPropertyValue(bean, field); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), field, e); } }
PropertyUtils { public static Object getProperty(Object bean, String field) { INSTANCE.checkParameters(bean, field); try { return INSTANCE.getPropertyValue(bean, field); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), field, e); }...
PropertyUtils { public static Object getProperty(Object bean, String field) { INSTANCE.checkParameters(bean, field); try { return INSTANCE.getPropertyValue(bean, field); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), field, e); }...
PropertyUtils { public static Object getProperty(Object bean, String field) { INSTANCE.checkParameters(bean, field); try { return INSTANCE.getPropertyValue(bean, field); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), field, e); }...
PropertyUtils { public static Object getProperty(Object bean, String field) { INSTANCE.checkParameters(bean, field); try { return INSTANCE.getPropertyValue(bean, field); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw handleReflectionException(bean.getClass(), field, e); }...
@Test public void stringMustExist() { Assert.assertTrue(ClassUtils.existsClass(String.class.getName())); }
public static boolean existsClass(String className) { try { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); loadClass(classLoader, className); return true; } catch (IllegalStateException e) { return false; } }
ClassUtils { public static boolean existsClass(String className) { try { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); loadClass(classLoader, className); return true; } catch (IllegalStateException e) { return false; } } }
ClassUtils { public static boolean existsClass(String className) { try { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); loadClass(classLoader, className); return true; } catch (IllegalStateException e) { return false; } } private ClassUtils(); }
ClassUtils { public static boolean existsClass(String className) { try { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); loadClass(classLoader, className); return true; } catch (IllegalStateException e) { return false; } } private ClassUtils(); static boolean existsClass(String className); st...
ClassUtils { public static boolean existsClass(String className) { try { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); loadClass(classLoader, className); return true; } catch (IllegalStateException e) { return false; } } private ClassUtils(); static boolean existsClass(String className); st...
@Test public void unknownClassMustNotExist() { Assert.assertFalse(ClassUtils.existsClass("does.not.exist")); }
public static boolean existsClass(String className) { try { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); loadClass(classLoader, className); return true; } catch (IllegalStateException e) { return false; } }
ClassUtils { public static boolean existsClass(String className) { try { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); loadClass(classLoader, className); return true; } catch (IllegalStateException e) { return false; } } }
ClassUtils { public static boolean existsClass(String className) { try { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); loadClass(classLoader, className); return true; } catch (IllegalStateException e) { return false; } } private ClassUtils(); }
ClassUtils { public static boolean existsClass(String className) { try { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); loadClass(classLoader, className); return true; } catch (IllegalStateException e) { return false; } } private ClassUtils(); static boolean existsClass(String className); st...
ClassUtils { public static boolean existsClass(String className) { try { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); loadClass(classLoader, className); return true; } catch (IllegalStateException e) { return false; } } private ClassUtils(); static boolean existsClass(String className); st...
@Test public void rawTypeFromParameterizedType() { Class<?> result = ClassUtils.getRawType(ProjectRepository.class.getGenericSuperclass()); assertThat(result).isEqualTo(ResourceRepositoryBase.class); }
public static Class<?> getRawType(Type type) { if (type instanceof Class) { return (Class<?>) type; } else if (type instanceof ParameterizedType) { return getRawType(((ParameterizedType) type).getRawType()); } else if (type instanceof TypeVariable<?>) { return getRawType(((TypeVariable<?>) type).getBounds()[0]); } else...
ClassUtils { public static Class<?> getRawType(Type type) { if (type instanceof Class) { return (Class<?>) type; } else if (type instanceof ParameterizedType) { return getRawType(((ParameterizedType) type).getRawType()); } else if (type instanceof TypeVariable<?>) { return getRawType(((TypeVariable<?>) type).getBounds(...
ClassUtils { public static Class<?> getRawType(Type type) { if (type instanceof Class) { return (Class<?>) type; } else if (type instanceof ParameterizedType) { return getRawType(((ParameterizedType) type).getRawType()); } else if (type instanceof TypeVariable<?>) { return getRawType(((TypeVariable<?>) type).getBounds(...
ClassUtils { public static Class<?> getRawType(Type type) { if (type instanceof Class) { return (Class<?>) type; } else if (type instanceof ParameterizedType) { return getRawType(((ParameterizedType) type).getRawType()); } else if (type instanceof TypeVariable<?>) { return getRawType(((TypeVariable<?>) type).getBounds(...
ClassUtils { public static Class<?> getRawType(Type type) { if (type instanceof Class) { return (Class<?>) type; } else if (type instanceof ParameterizedType) { return getRawType(((ParameterizedType) type).getRawType()); } else if (type instanceof TypeVariable<?>) { return getRawType(((TypeVariable<?>) type).getBounds(...
@Test public void rawTypeFromRawType() { Class<?> result = ClassUtils.getRawType(String.class); assertThat(result).isEqualTo(String.class); }
public static Class<?> getRawType(Type type) { if (type instanceof Class) { return (Class<?>) type; } else if (type instanceof ParameterizedType) { return getRawType(((ParameterizedType) type).getRawType()); } else if (type instanceof TypeVariable<?>) { return getRawType(((TypeVariable<?>) type).getBounds()[0]); } else...
ClassUtils { public static Class<?> getRawType(Type type) { if (type instanceof Class) { return (Class<?>) type; } else if (type instanceof ParameterizedType) { return getRawType(((ParameterizedType) type).getRawType()); } else if (type instanceof TypeVariable<?>) { return getRawType(((TypeVariable<?>) type).getBounds(...
ClassUtils { public static Class<?> getRawType(Type type) { if (type instanceof Class) { return (Class<?>) type; } else if (type instanceof ParameterizedType) { return getRawType(((ParameterizedType) type).getRawType()); } else if (type instanceof TypeVariable<?>) { return getRawType(((TypeVariable<?>) type).getBounds(...
ClassUtils { public static Class<?> getRawType(Type type) { if (type instanceof Class) { return (Class<?>) type; } else if (type instanceof ParameterizedType) { return getRawType(((ParameterizedType) type).getRawType()); } else if (type instanceof TypeVariable<?>) { return getRawType(((TypeVariable<?>) type).getBounds(...
ClassUtils { public static Class<?> getRawType(Type type) { if (type instanceof Class) { return (Class<?>) type; } else if (type instanceof ParameterizedType) { return getRawType(((ParameterizedType) type).getRawType()); } else if (type instanceof TypeVariable<?>) { return getRawType(((TypeVariable<?>) type).getBounds(...
@Test(expected = IllegalStateException.class) public void exceptionForUnknownRawType() { ClassUtils.getRawType(null); }
public static Class<?> getRawType(Type type) { if (type instanceof Class) { return (Class<?>) type; } else if (type instanceof ParameterizedType) { return getRawType(((ParameterizedType) type).getRawType()); } else if (type instanceof TypeVariable<?>) { return getRawType(((TypeVariable<?>) type).getBounds()[0]); } else...
ClassUtils { public static Class<?> getRawType(Type type) { if (type instanceof Class) { return (Class<?>) type; } else if (type instanceof ParameterizedType) { return getRawType(((ParameterizedType) type).getRawType()); } else if (type instanceof TypeVariable<?>) { return getRawType(((TypeVariable<?>) type).getBounds(...
ClassUtils { public static Class<?> getRawType(Type type) { if (type instanceof Class) { return (Class<?>) type; } else if (type instanceof ParameterizedType) { return getRawType(((ParameterizedType) type).getRawType()); } else if (type instanceof TypeVariable<?>) { return getRawType(((TypeVariable<?>) type).getBounds(...
ClassUtils { public static Class<?> getRawType(Type type) { if (type instanceof Class) { return (Class<?>) type; } else if (type instanceof ParameterizedType) { return getRawType(((ParameterizedType) type).getRawType()); } else if (type instanceof TypeVariable<?>) { return getRawType(((TypeVariable<?>) type).getBounds(...
ClassUtils { public static Class<?> getRawType(Type type) { if (type instanceof Class) { return (Class<?>) type; } else if (type instanceof ParameterizedType) { return getRawType(((ParameterizedType) type).getRawType()); } else if (type instanceof TypeVariable<?>) { return getRawType(((TypeVariable<?>) type).getBounds(...
@Test public void onClassInheritanceShouldReturnInheritedClasses() { List<Field> result = ClassUtils.getClassFields(ChildClass.class); assertThat(result).hasSize(2); }
public static List<Field> getClassFields(Class<?> beanClass) { Map<String, Field> resultMap = new HashMap<>(); LinkedList<Field> results = new LinkedList<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { for (Field field : currentClass.getDeclaredFields()) { if (!fie...
ClassUtils { public static List<Field> getClassFields(Class<?> beanClass) { Map<String, Field> resultMap = new HashMap<>(); LinkedList<Field> results = new LinkedList<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { for (Field field : currentClass.getDeclaredFields(...
ClassUtils { public static List<Field> getClassFields(Class<?> beanClass) { Map<String, Field> resultMap = new HashMap<>(); LinkedList<Field> results = new LinkedList<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { for (Field field : currentClass.getDeclaredFields(...
ClassUtils { public static List<Field> getClassFields(Class<?> beanClass) { Map<String, Field> resultMap = new HashMap<>(); LinkedList<Field> results = new LinkedList<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { for (Field field : currentClass.getDeclaredFields(...
ClassUtils { public static List<Field> getClassFields(Class<?> beanClass) { Map<String, Field> resultMap = new HashMap<>(); LinkedList<Field> results = new LinkedList<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { for (Field field : currentClass.getDeclaredFields(...
@Test public void onClassInheritanceShouldReturnInheritedField() { Field result = ClassUtils.findClassField(ChildClass.class, "parentField"); assertThat(result).isNotNull(); assertThat(result.getName()).isEqualTo("parentField"); assertThat(result.getDeclaringClass()).isEqualTo(ParentClass.class); }
public static Field findClassField(Class<?> beanClass, String fieldName) { Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { for (Field field : currentClass.getDeclaredFields()) { if (field.isSynthetic()) { continue; } if (field.getName().equals(fieldName)) { return field...
ClassUtils { public static Field findClassField(Class<?> beanClass, String fieldName) { Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { for (Field field : currentClass.getDeclaredFields()) { if (field.isSynthetic()) { continue; } if (field.getName().equals(fieldName)) {...
ClassUtils { public static Field findClassField(Class<?> beanClass, String fieldName) { Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { for (Field field : currentClass.getDeclaredFields()) { if (field.isSynthetic()) { continue; } if (field.getName().equals(fieldName)) {...
ClassUtils { public static Field findClassField(Class<?> beanClass, String fieldName) { Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { for (Field field : currentClass.getDeclaredFields()) { if (field.isSynthetic()) { continue; } if (field.getName().equals(fieldName)) {...
ClassUtils { public static Field findClassField(Class<?> beanClass, String fieldName) { Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { for (Field field : currentClass.getDeclaredFields()) { if (field.isSynthetic()) { continue; } if (field.getName().equals(fieldName)) {...
@Test public void testNullData() { Document doc = new Document(); doc.setData(Nullable.nullValue()); Assert.assertNull(documentMapper.fromDocument(doc, false, queryContext)); }
public Object fromDocument(Document document, boolean getList, QueryContext queryContext) { ControllerContext controllerContext = new ControllerContext(moduleRegistry, () -> this); ClientResourceUpsert upsert = new ClientResourceUpsert(proxyFactory); upsert.init(controllerContext); PreconditionUtil.verify(document.getE...
ClientDocumentMapper extends DocumentMapper { public Object fromDocument(Document document, boolean getList, QueryContext queryContext) { ControllerContext controllerContext = new ControllerContext(moduleRegistry, () -> this); ClientResourceUpsert upsert = new ClientResourceUpsert(proxyFactory); upsert.init(controllerC...
ClientDocumentMapper extends DocumentMapper { public Object fromDocument(Document document, boolean getList, QueryContext queryContext) { ControllerContext controllerContext = new ControllerContext(moduleRegistry, () -> this); ClientResourceUpsert upsert = new ClientResourceUpsert(proxyFactory); upsert.init(controllerC...
ClientDocumentMapper extends DocumentMapper { public Object fromDocument(Document document, boolean getList, QueryContext queryContext) { ControllerContext controllerContext = new ControllerContext(moduleRegistry, () -> this); ClientResourceUpsert upsert = new ClientResourceUpsert(proxyFactory); upsert.init(controllerC...
ClientDocumentMapper extends DocumentMapper { public Object fromDocument(Document document, boolean getList, QueryContext queryContext) { ControllerContext controllerContext = new ControllerContext(moduleRegistry, () -> this); ClientResourceUpsert upsert = new ClientResourceUpsert(proxyFactory); upsert.init(controllerC...
@Test public void onGetGettersShouldReturnMethodsStartingWithGet() throws Exception { List<Method> result = ClassUtils.getClassGetters(ParentClass.class); assertThat(result).doesNotContain(ParentClass.class.getDeclaredMethod("aetParentField")); }
public static List<Method> getClassGetters(Class<?> beanClass) { Map<String, Method> resultMap = new HashMap<>(); LinkedList<Method> results = new LinkedList<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { getDeclaredClassGetters(currentClass, resultMap, results); ...
ClassUtils { public static List<Method> getClassGetters(Class<?> beanClass) { Map<String, Method> resultMap = new HashMap<>(); LinkedList<Method> results = new LinkedList<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { getDeclaredClassGetters(currentClass, resultMa...
ClassUtils { public static List<Method> getClassGetters(Class<?> beanClass) { Map<String, Method> resultMap = new HashMap<>(); LinkedList<Method> results = new LinkedList<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { getDeclaredClassGetters(currentClass, resultMa...
ClassUtils { public static List<Method> getClassGetters(Class<?> beanClass) { Map<String, Method> resultMap = new HashMap<>(); LinkedList<Method> results = new LinkedList<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { getDeclaredClassGetters(currentClass, resultMa...
ClassUtils { public static List<Method> getClassGetters(Class<?> beanClass) { Map<String, Method> resultMap = new HashMap<>(); LinkedList<Method> results = new LinkedList<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { getDeclaredClassGetters(currentClass, resultMa...
@Test public void onGetGettersShouldReturnMethodsThatNotTakeParams() throws Exception { List<Method> result = ClassUtils.getClassGetters(ParentClass.class); assertThat(result).doesNotContain(ParentClass.class.getDeclaredMethod("getParentFieldWithParameter", String.class)); }
public static List<Method> getClassGetters(Class<?> beanClass) { Map<String, Method> resultMap = new HashMap<>(); LinkedList<Method> results = new LinkedList<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { getDeclaredClassGetters(currentClass, resultMap, results); ...
ClassUtils { public static List<Method> getClassGetters(Class<?> beanClass) { Map<String, Method> resultMap = new HashMap<>(); LinkedList<Method> results = new LinkedList<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { getDeclaredClassGetters(currentClass, resultMa...
ClassUtils { public static List<Method> getClassGetters(Class<?> beanClass) { Map<String, Method> resultMap = new HashMap<>(); LinkedList<Method> results = new LinkedList<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { getDeclaredClassGetters(currentClass, resultMa...
ClassUtils { public static List<Method> getClassGetters(Class<?> beanClass) { Map<String, Method> resultMap = new HashMap<>(); LinkedList<Method> results = new LinkedList<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { getDeclaredClassGetters(currentClass, resultMa...
ClassUtils { public static List<Method> getClassGetters(Class<?> beanClass) { Map<String, Method> resultMap = new HashMap<>(); LinkedList<Method> results = new LinkedList<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { getDeclaredClassGetters(currentClass, resultMa...
@Test public void onGetGettersShouldReturnMethodsThatReturnValue() throws Exception { List<Method> result = ClassUtils.getClassGetters(ParentClass.class); assertThat(result).doesNotContain(ParentClass.class.getDeclaredMethod("getParentFieldReturningVoid")); }
public static List<Method> getClassGetters(Class<?> beanClass) { Map<String, Method> resultMap = new HashMap<>(); LinkedList<Method> results = new LinkedList<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { getDeclaredClassGetters(currentClass, resultMap, results); ...
ClassUtils { public static List<Method> getClassGetters(Class<?> beanClass) { Map<String, Method> resultMap = new HashMap<>(); LinkedList<Method> results = new LinkedList<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { getDeclaredClassGetters(currentClass, resultMa...
ClassUtils { public static List<Method> getClassGetters(Class<?> beanClass) { Map<String, Method> resultMap = new HashMap<>(); LinkedList<Method> results = new LinkedList<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { getDeclaredClassGetters(currentClass, resultMa...
ClassUtils { public static List<Method> getClassGetters(Class<?> beanClass) { Map<String, Method> resultMap = new HashMap<>(); LinkedList<Method> results = new LinkedList<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { getDeclaredClassGetters(currentClass, resultMa...
ClassUtils { public static List<Method> getClassGetters(Class<?> beanClass) { Map<String, Method> resultMap = new HashMap<>(); LinkedList<Method> results = new LinkedList<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { getDeclaredClassGetters(currentClass, resultMa...
@Test public void onGetGettersShouldReturnBooleanGettersThatHaveName() throws Exception { List<Method> result = ClassUtils.getClassGetters(ParentClass.class); assertThat(result).doesNotContain(ParentClass.class.getDeclaredMethod("is")); }
public static List<Method> getClassGetters(Class<?> beanClass) { Map<String, Method> resultMap = new HashMap<>(); LinkedList<Method> results = new LinkedList<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { getDeclaredClassGetters(currentClass, resultMap, results); ...
ClassUtils { public static List<Method> getClassGetters(Class<?> beanClass) { Map<String, Method> resultMap = new HashMap<>(); LinkedList<Method> results = new LinkedList<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { getDeclaredClassGetters(currentClass, resultMa...
ClassUtils { public static List<Method> getClassGetters(Class<?> beanClass) { Map<String, Method> resultMap = new HashMap<>(); LinkedList<Method> results = new LinkedList<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { getDeclaredClassGetters(currentClass, resultMa...
ClassUtils { public static List<Method> getClassGetters(Class<?> beanClass) { Map<String, Method> resultMap = new HashMap<>(); LinkedList<Method> results = new LinkedList<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { getDeclaredClassGetters(currentClass, resultMa...
ClassUtils { public static List<Method> getClassGetters(Class<?> beanClass) { Map<String, Method> resultMap = new HashMap<>(); LinkedList<Method> results = new LinkedList<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { getDeclaredClassGetters(currentClass, resultMa...
@Test public void onGetGettersShouldReturnNonBooleanGettersThatHaveName() throws Exception { List<Method> result = ClassUtils.getClassGetters(ParentClass.class); assertThat(result).doesNotContain(ParentClass.class.getDeclaredMethod("get")); }
public static List<Method> getClassGetters(Class<?> beanClass) { Map<String, Method> resultMap = new HashMap<>(); LinkedList<Method> results = new LinkedList<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { getDeclaredClassGetters(currentClass, resultMap, results); ...
ClassUtils { public static List<Method> getClassGetters(Class<?> beanClass) { Map<String, Method> resultMap = new HashMap<>(); LinkedList<Method> results = new LinkedList<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { getDeclaredClassGetters(currentClass, resultMa...
ClassUtils { public static List<Method> getClassGetters(Class<?> beanClass) { Map<String, Method> resultMap = new HashMap<>(); LinkedList<Method> results = new LinkedList<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { getDeclaredClassGetters(currentClass, resultMa...
ClassUtils { public static List<Method> getClassGetters(Class<?> beanClass) { Map<String, Method> resultMap = new HashMap<>(); LinkedList<Method> results = new LinkedList<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { getDeclaredClassGetters(currentClass, resultMa...
ClassUtils { public static List<Method> getClassGetters(Class<?> beanClass) { Map<String, Method> resultMap = new HashMap<>(); LinkedList<Method> results = new LinkedList<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { getDeclaredClassGetters(currentClass, resultMa...
@Test public void onClassInheritanceShouldReturnInheritedGetters() { List<Method> result = ClassUtils.getClassGetters(ChildClass.class); assertThat(result).hasSize(5); }
public static List<Method> getClassGetters(Class<?> beanClass) { Map<String, Method> resultMap = new HashMap<>(); LinkedList<Method> results = new LinkedList<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { getDeclaredClassGetters(currentClass, resultMap, results); ...
ClassUtils { public static List<Method> getClassGetters(Class<?> beanClass) { Map<String, Method> resultMap = new HashMap<>(); LinkedList<Method> results = new LinkedList<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { getDeclaredClassGetters(currentClass, resultMa...
ClassUtils { public static List<Method> getClassGetters(Class<?> beanClass) { Map<String, Method> resultMap = new HashMap<>(); LinkedList<Method> results = new LinkedList<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { getDeclaredClassGetters(currentClass, resultMa...
ClassUtils { public static List<Method> getClassGetters(Class<?> beanClass) { Map<String, Method> resultMap = new HashMap<>(); LinkedList<Method> results = new LinkedList<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { getDeclaredClassGetters(currentClass, resultMa...
ClassUtils { public static List<Method> getClassGetters(Class<?> beanClass) { Map<String, Method> resultMap = new HashMap<>(); LinkedList<Method> results = new LinkedList<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { getDeclaredClassGetters(currentClass, resultMa...
@Test public void onFindGetterShouldReturnBooleanPropertyWithGet() { Method method = ClassUtils.findGetter(ParentClass.class, "booleanPropertyWithGet"); assertThat(method.getName()).isEqualTo("getBooleanPropertyWithGet"); }
public static Method findGetter(Class<?> beanClass, String fieldName) { for (Method method : beanClass.getMethods()) { if (!isGetter(method)) { continue; } String methodGetterName = getGetterFieldName(method); if (fieldName.equals(methodGetterName)) { return method; } } return null; }
ClassUtils { public static Method findGetter(Class<?> beanClass, String fieldName) { for (Method method : beanClass.getMethods()) { if (!isGetter(method)) { continue; } String methodGetterName = getGetterFieldName(method); if (fieldName.equals(methodGetterName)) { return method; } } return null; } }
ClassUtils { public static Method findGetter(Class<?> beanClass, String fieldName) { for (Method method : beanClass.getMethods()) { if (!isGetter(method)) { continue; } String methodGetterName = getGetterFieldName(method); if (fieldName.equals(methodGetterName)) { return method; } } return null; } private ClassUtils()...
ClassUtils { public static Method findGetter(Class<?> beanClass, String fieldName) { for (Method method : beanClass.getMethods()) { if (!isGetter(method)) { continue; } String methodGetterName = getGetterFieldName(method); if (fieldName.equals(methodGetterName)) { return method; } } return null; } private ClassUtils()...
ClassUtils { public static Method findGetter(Class<?> beanClass, String fieldName) { for (Method method : beanClass.getMethods()) { if (!isGetter(method)) { continue; } String methodGetterName = getGetterFieldName(method); if (fieldName.equals(methodGetterName)) { return method; } } return null; } private ClassUtils()...
@Test public void onGetSettersShouldReturnMethodsThatSetValue() throws Exception { List<Method> result = ClassUtils.getClassSetters(ParentClass.class); assertThat(result).containsOnly(ParentClass.class.getDeclaredMethod("setValue", String.class)); }
public static List<Method> getClassSetters(Class<?> beanClass) { Map<String, Method> result = new HashMap<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { for (Method method : currentClass.getDeclaredMethods()) { if (!method.isSynthetic() && isSetter(method)) { resu...
ClassUtils { public static List<Method> getClassSetters(Class<?> beanClass) { Map<String, Method> result = new HashMap<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { for (Method method : currentClass.getDeclaredMethods()) { if (!method.isSynthetic() && isSetter(me...
ClassUtils { public static List<Method> getClassSetters(Class<?> beanClass) { Map<String, Method> result = new HashMap<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { for (Method method : currentClass.getDeclaredMethods()) { if (!method.isSynthetic() && isSetter(me...
ClassUtils { public static List<Method> getClassSetters(Class<?> beanClass) { Map<String, Method> result = new HashMap<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { for (Method method : currentClass.getDeclaredMethods()) { if (!method.isSynthetic() && isSetter(me...
ClassUtils { public static List<Method> getClassSetters(Class<?> beanClass) { Map<String, Method> result = new HashMap<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { for (Method method : currentClass.getDeclaredMethods()) { if (!method.isSynthetic() && isSetter(me...
@Test public void onClassInheritanceShouldReturnInheritedSetters() { List<Method> result = ClassUtils.getClassSetters(ChildClass.class); assertThat(result).hasSize(1); }
public static List<Method> getClassSetters(Class<?> beanClass) { Map<String, Method> result = new HashMap<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { for (Method method : currentClass.getDeclaredMethods()) { if (!method.isSynthetic() && isSetter(method)) { resu...
ClassUtils { public static List<Method> getClassSetters(Class<?> beanClass) { Map<String, Method> result = new HashMap<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { for (Method method : currentClass.getDeclaredMethods()) { if (!method.isSynthetic() && isSetter(me...
ClassUtils { public static List<Method> getClassSetters(Class<?> beanClass) { Map<String, Method> result = new HashMap<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { for (Method method : currentClass.getDeclaredMethods()) { if (!method.isSynthetic() && isSetter(me...
ClassUtils { public static List<Method> getClassSetters(Class<?> beanClass) { Map<String, Method> result = new HashMap<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { for (Method method : currentClass.getDeclaredMethods()) { if (!method.isSynthetic() && isSetter(me...
ClassUtils { public static List<Method> getClassSetters(Class<?> beanClass) { Map<String, Method> result = new HashMap<>(); Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { for (Method method : currentClass.getDeclaredMethods()) { if (!method.isSynthetic() && isSetter(me...
@Test public void onGetAnnotationShouldReturnAnnotation() { Optional<JsonApiResource> result = ClassUtils.getAnnotation(ResourceClass.class, JsonApiResource.class); assertThat(result.get()).isInstanceOf(JsonApiResource.class); }
public static <T extends Annotation> Optional<T> getAnnotation(Class<?> beanClass, Class<T> annotationClass) { Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { if (currentClass.isAnnotationPresent(annotationClass)) { return Optional.of(currentClass.getAnnotation(annotati...
ClassUtils { public static <T extends Annotation> Optional<T> getAnnotation(Class<?> beanClass, Class<T> annotationClass) { Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { if (currentClass.isAnnotationPresent(annotationClass)) { return Optional.of(currentClass.getAnnota...
ClassUtils { public static <T extends Annotation> Optional<T> getAnnotation(Class<?> beanClass, Class<T> annotationClass) { Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { if (currentClass.isAnnotationPresent(annotationClass)) { return Optional.of(currentClass.getAnnota...
ClassUtils { public static <T extends Annotation> Optional<T> getAnnotation(Class<?> beanClass, Class<T> annotationClass) { Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { if (currentClass.isAnnotationPresent(annotationClass)) { return Optional.of(currentClass.getAnnota...
ClassUtils { public static <T extends Annotation> Optional<T> getAnnotation(Class<?> beanClass, Class<T> annotationClass) { Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { if (currentClass.isAnnotationPresent(annotationClass)) { return Optional.of(currentClass.getAnnota...
@Test public void testNoData() { Document doc = new Document(); doc.setData(Nullable.empty()); Assert.assertNull(documentMapper.fromDocument(doc, false, queryContext)); }
public Object fromDocument(Document document, boolean getList, QueryContext queryContext) { ControllerContext controllerContext = new ControllerContext(moduleRegistry, () -> this); ClientResourceUpsert upsert = new ClientResourceUpsert(proxyFactory); upsert.init(controllerContext); PreconditionUtil.verify(document.getE...
ClientDocumentMapper extends DocumentMapper { public Object fromDocument(Document document, boolean getList, QueryContext queryContext) { ControllerContext controllerContext = new ControllerContext(moduleRegistry, () -> this); ClientResourceUpsert upsert = new ClientResourceUpsert(proxyFactory); upsert.init(controllerC...
ClientDocumentMapper extends DocumentMapper { public Object fromDocument(Document document, boolean getList, QueryContext queryContext) { ControllerContext controllerContext = new ControllerContext(moduleRegistry, () -> this); ClientResourceUpsert upsert = new ClientResourceUpsert(proxyFactory); upsert.init(controllerC...
ClientDocumentMapper extends DocumentMapper { public Object fromDocument(Document document, boolean getList, QueryContext queryContext) { ControllerContext controllerContext = new ControllerContext(moduleRegistry, () -> this); ClientResourceUpsert upsert = new ClientResourceUpsert(proxyFactory); upsert.init(controllerC...
ClientDocumentMapper extends DocumentMapper { public Object fromDocument(Document document, boolean getList, QueryContext queryContext) { ControllerContext controllerContext = new ControllerContext(moduleRegistry, () -> this); ClientResourceUpsert upsert = new ClientResourceUpsert(proxyFactory); upsert.init(controllerC...
@Test public void onGetAnnotationShouldReturnParentAnnotation() { Optional<JsonPropertyOrder> result = ClassUtils.getAnnotation(ChildClass.class, JsonPropertyOrder.class); assertThat(result.get()).isInstanceOf(JsonPropertyOrder.class); }
public static <T extends Annotation> Optional<T> getAnnotation(Class<?> beanClass, Class<T> annotationClass) { Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { if (currentClass.isAnnotationPresent(annotationClass)) { return Optional.of(currentClass.getAnnotation(annotati...
ClassUtils { public static <T extends Annotation> Optional<T> getAnnotation(Class<?> beanClass, Class<T> annotationClass) { Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { if (currentClass.isAnnotationPresent(annotationClass)) { return Optional.of(currentClass.getAnnota...
ClassUtils { public static <T extends Annotation> Optional<T> getAnnotation(Class<?> beanClass, Class<T> annotationClass) { Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { if (currentClass.isAnnotationPresent(annotationClass)) { return Optional.of(currentClass.getAnnota...
ClassUtils { public static <T extends Annotation> Optional<T> getAnnotation(Class<?> beanClass, Class<T> annotationClass) { Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { if (currentClass.isAnnotationPresent(annotationClass)) { return Optional.of(currentClass.getAnnota...
ClassUtils { public static <T extends Annotation> Optional<T> getAnnotation(Class<?> beanClass, Class<T> annotationClass) { Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { if (currentClass.isAnnotationPresent(annotationClass)) { return Optional.of(currentClass.getAnnota...
@Test public void onNonExistingAnnotationShouldReturnEmptyResult() { Optional<JsonIgnore> result = ClassUtils.getAnnotation(ResourceClass.class, JsonIgnore.class); assertThat(result.isPresent()).isFalse(); }
public static <T extends Annotation> Optional<T> getAnnotation(Class<?> beanClass, Class<T> annotationClass) { Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { if (currentClass.isAnnotationPresent(annotationClass)) { return Optional.of(currentClass.getAnnotation(annotati...
ClassUtils { public static <T extends Annotation> Optional<T> getAnnotation(Class<?> beanClass, Class<T> annotationClass) { Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { if (currentClass.isAnnotationPresent(annotationClass)) { return Optional.of(currentClass.getAnnota...
ClassUtils { public static <T extends Annotation> Optional<T> getAnnotation(Class<?> beanClass, Class<T> annotationClass) { Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { if (currentClass.isAnnotationPresent(annotationClass)) { return Optional.of(currentClass.getAnnota...
ClassUtils { public static <T extends Annotation> Optional<T> getAnnotation(Class<?> beanClass, Class<T> annotationClass) { Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { if (currentClass.isAnnotationPresent(annotationClass)) { return Optional.of(currentClass.getAnnota...
ClassUtils { public static <T extends Annotation> Optional<T> getAnnotation(Class<?> beanClass, Class<T> annotationClass) { Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { if (currentClass.isAnnotationPresent(annotationClass)) { return Optional.of(currentClass.getAnnota...
@Test public void onValidClassShouldCreateNewInstance() { ResourceClass result = ClassUtils.newInstance(ResourceClass.class); assertThat(result).isInstanceOf(ResourceClass.class); }
public static <T> T newInstance(Class<T> clazz) { try { return clazz.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new ResourceException(String.format("couldn't create a new instance of %s", clazz), e); } }
ClassUtils { public static <T> T newInstance(Class<T> clazz) { try { return clazz.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new ResourceException(String.format("couldn't create a new instance of %s", clazz), e); } } }
ClassUtils { public static <T> T newInstance(Class<T> clazz) { try { return clazz.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new ResourceException(String.format("couldn't create a new instance of %s", clazz), e); } } private ClassUtils(); }
ClassUtils { public static <T> T newInstance(Class<T> clazz) { try { return clazz.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new ResourceException(String.format("couldn't create a new instance of %s", clazz), e); } } private ClassUtils(); static boolean existsClass(String classN...
ClassUtils { public static <T> T newInstance(Class<T> clazz) { try { return clazz.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new ResourceException(String.format("couldn't create a new instance of %s", clazz), e); } } private ClassUtils(); static boolean existsClass(String classN...
@Test(expected = IllegalStateException.class) public void onClassWithCrushingConstructorShouldThrowException() { ClassUtils.newInstance(ClassWithCrashingConstructor.class); }
public static <T> T newInstance(Class<T> clazz) { try { return clazz.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new ResourceException(String.format("couldn't create a new instance of %s", clazz), e); } }
ClassUtils { public static <T> T newInstance(Class<T> clazz) { try { return clazz.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new ResourceException(String.format("couldn't create a new instance of %s", clazz), e); } } }
ClassUtils { public static <T> T newInstance(Class<T> clazz) { try { return clazz.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new ResourceException(String.format("couldn't create a new instance of %s", clazz), e); } } private ClassUtils(); }
ClassUtils { public static <T> T newInstance(Class<T> clazz) { try { return clazz.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new ResourceException(String.format("couldn't create a new instance of %s", clazz), e); } } private ClassUtils(); static boolean existsClass(String classN...
ClassUtils { public static <T> T newInstance(Class<T> clazz) { try { return clazz.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new ResourceException(String.format("couldn't create a new instance of %s", clazz), e); } } private ClassUtils(); static boolean existsClass(String classN...
@Test(expected = ResourceException.class) public void onClassWithoutDefaultConstructorShouldThrowException() { ClassUtils.newInstance(ClassWithoutDefaultConstructor.class); }
public static <T> T newInstance(Class<T> clazz) { try { return clazz.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new ResourceException(String.format("couldn't create a new instance of %s", clazz), e); } }
ClassUtils { public static <T> T newInstance(Class<T> clazz) { try { return clazz.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new ResourceException(String.format("couldn't create a new instance of %s", clazz), e); } } }
ClassUtils { public static <T> T newInstance(Class<T> clazz) { try { return clazz.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new ResourceException(String.format("couldn't create a new instance of %s", clazz), e); } } private ClassUtils(); }
ClassUtils { public static <T> T newInstance(Class<T> clazz) { try { return clazz.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new ResourceException(String.format("couldn't create a new instance of %s", clazz), e); } } private ClassUtils(); static boolean existsClass(String classN...
ClassUtils { public static <T> T newInstance(Class<T> clazz) { try { return clazz.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new ResourceException(String.format("couldn't create a new instance of %s", clazz), e); } } private ClassUtils(); static boolean existsClass(String classN...
@Test public void onFindGetterShouldReturnIntegerMethod() { Method method = ClassUtils.findGetter(IntegerClass.class, "id"); assertThat(method.getName()).isEqualTo("getId"); }
public static Method findGetter(Class<?> beanClass, String fieldName) { for (Method method : beanClass.getMethods()) { if (!isGetter(method)) { continue; } String methodGetterName = getGetterFieldName(method); if (fieldName.equals(methodGetterName)) { return method; } } return null; }
ClassUtils { public static Method findGetter(Class<?> beanClass, String fieldName) { for (Method method : beanClass.getMethods()) { if (!isGetter(method)) { continue; } String methodGetterName = getGetterFieldName(method); if (fieldName.equals(methodGetterName)) { return method; } } return null; } }
ClassUtils { public static Method findGetter(Class<?> beanClass, String fieldName) { for (Method method : beanClass.getMethods()) { if (!isGetter(method)) { continue; } String methodGetterName = getGetterFieldName(method); if (fieldName.equals(methodGetterName)) { return method; } } return null; } private ClassUtils()...
ClassUtils { public static Method findGetter(Class<?> beanClass, String fieldName) { for (Method method : beanClass.getMethods()) { if (!isGetter(method)) { continue; } String methodGetterName = getGetterFieldName(method); if (fieldName.equals(methodGetterName)) { return method; } } return null; } private ClassUtils()...
ClassUtils { public static Method findGetter(Class<?> beanClass, String fieldName) { for (Method method : beanClass.getMethods()) { if (!isGetter(method)) { continue; } String methodGetterName = getGetterFieldName(method); if (fieldName.equals(methodGetterName)) { return method; } } return null; } private ClassUtils()...
@Test public void onFindSetterShouldReturnIntegerMethod() { Method method = ClassUtils.findSetter(IntegerClass.class, "id", Integer.class); assertThat(method.getName()).isEqualTo("setId"); }
public static Method findSetter(Class<?> beanClass, String fieldName, Class<?> fieldType) { String upperCaseName = fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1); String methodName = "set" + upperCaseName; try { return beanClass.getMethod(methodName, fieldType); } catch (NoSuchMethodException e1) { } ...
ClassUtils { public static Method findSetter(Class<?> beanClass, String fieldName, Class<?> fieldType) { String upperCaseName = fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1); String methodName = "set" + upperCaseName; try { return beanClass.getMethod(methodName, fieldType); } catch (NoSuchMethodExcep...
ClassUtils { public static Method findSetter(Class<?> beanClass, String fieldName, Class<?> fieldType) { String upperCaseName = fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1); String methodName = "set" + upperCaseName; try { return beanClass.getMethod(methodName, fieldType); } catch (NoSuchMethodExcep...
ClassUtils { public static Method findSetter(Class<?> beanClass, String fieldName, Class<?> fieldType) { String upperCaseName = fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1); String methodName = "set" + upperCaseName; try { return beanClass.getMethod(methodName, fieldType); } catch (NoSuchMethodExcep...
ClassUtils { public static Method findSetter(Class<?> beanClass, String fieldName, Class<?> fieldType) { String upperCaseName = fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1); String methodName = "set" + upperCaseName; try { return beanClass.getMethod(methodName, fieldType); } catch (NoSuchMethodExcep...
@Test public void onFindGetterShouldReturnPrimitiveBooleanMethod() { Method method = ClassUtils.findGetter(ParentClass.class, "primitiveBooleanProperty"); assertThat(method.getName()).isEqualTo("isPrimitiveBooleanProperty"); }
public static Method findGetter(Class<?> beanClass, String fieldName) { for (Method method : beanClass.getMethods()) { if (!isGetter(method)) { continue; } String methodGetterName = getGetterFieldName(method); if (fieldName.equals(methodGetterName)) { return method; } } return null; }
ClassUtils { public static Method findGetter(Class<?> beanClass, String fieldName) { for (Method method : beanClass.getMethods()) { if (!isGetter(method)) { continue; } String methodGetterName = getGetterFieldName(method); if (fieldName.equals(methodGetterName)) { return method; } } return null; } }
ClassUtils { public static Method findGetter(Class<?> beanClass, String fieldName) { for (Method method : beanClass.getMethods()) { if (!isGetter(method)) { continue; } String methodGetterName = getGetterFieldName(method); if (fieldName.equals(methodGetterName)) { return method; } } return null; } private ClassUtils()...
ClassUtils { public static Method findGetter(Class<?> beanClass, String fieldName) { for (Method method : beanClass.getMethods()) { if (!isGetter(method)) { continue; } String methodGetterName = getGetterFieldName(method); if (fieldName.equals(methodGetterName)) { return method; } } return null; } private ClassUtils()...
ClassUtils { public static Method findGetter(Class<?> beanClass, String fieldName) { for (Method method : beanClass.getMethods()) { if (!isGetter(method)) { continue; } String methodGetterName = getGetterFieldName(method); if (fieldName.equals(methodGetterName)) { return method; } } return null; } private ClassUtils()...
@Test public void onFindGetterShouldReturnBooleanMethod() { Method method = ClassUtils.findGetter(ParentClass.class, "booleanProperty"); assertThat(method.getName()).isEqualTo("isBooleanProperty"); }
public static Method findGetter(Class<?> beanClass, String fieldName) { for (Method method : beanClass.getMethods()) { if (!isGetter(method)) { continue; } String methodGetterName = getGetterFieldName(method); if (fieldName.equals(methodGetterName)) { return method; } } return null; }
ClassUtils { public static Method findGetter(Class<?> beanClass, String fieldName) { for (Method method : beanClass.getMethods()) { if (!isGetter(method)) { continue; } String methodGetterName = getGetterFieldName(method); if (fieldName.equals(methodGetterName)) { return method; } } return null; } }
ClassUtils { public static Method findGetter(Class<?> beanClass, String fieldName) { for (Method method : beanClass.getMethods()) { if (!isGetter(method)) { continue; } String methodGetterName = getGetterFieldName(method); if (fieldName.equals(methodGetterName)) { return method; } } return null; } private ClassUtils()...
ClassUtils { public static Method findGetter(Class<?> beanClass, String fieldName) { for (Method method : beanClass.getMethods()) { if (!isGetter(method)) { continue; } String methodGetterName = getGetterFieldName(method); if (fieldName.equals(methodGetterName)) { return method; } } return null; } private ClassUtils()...
ClassUtils { public static Method findGetter(Class<?> beanClass, String fieldName) { for (Method method : beanClass.getMethods()) { if (!isGetter(method)) { continue; } String methodGetterName = getGetterFieldName(method); if (fieldName.equals(methodGetterName)) { return method; } } return null; } private ClassUtils()...
@Test public void onFindGetterShouldNotReturnNonBooleanIsMethods() { Method method = ClassUtils.findGetter(InvalidBooleanClass.class, "notABooleanReturnType"); assertThat(method).isNull(); }
public static Method findGetter(Class<?> beanClass, String fieldName) { for (Method method : beanClass.getMethods()) { if (!isGetter(method)) { continue; } String methodGetterName = getGetterFieldName(method); if (fieldName.equals(methodGetterName)) { return method; } } return null; }
ClassUtils { public static Method findGetter(Class<?> beanClass, String fieldName) { for (Method method : beanClass.getMethods()) { if (!isGetter(method)) { continue; } String methodGetterName = getGetterFieldName(method); if (fieldName.equals(methodGetterName)) { return method; } } return null; } }
ClassUtils { public static Method findGetter(Class<?> beanClass, String fieldName) { for (Method method : beanClass.getMethods()) { if (!isGetter(method)) { continue; } String methodGetterName = getGetterFieldName(method); if (fieldName.equals(methodGetterName)) { return method; } } return null; } private ClassUtils()...
ClassUtils { public static Method findGetter(Class<?> beanClass, String fieldName) { for (Method method : beanClass.getMethods()) { if (!isGetter(method)) { continue; } String methodGetterName = getGetterFieldName(method); if (fieldName.equals(methodGetterName)) { return method; } } return null; } private ClassUtils()...
ClassUtils { public static Method findGetter(Class<?> beanClass, String fieldName) { for (Method method : beanClass.getMethods()) { if (!isGetter(method)) { continue; } String methodGetterName = getGetterFieldName(method); if (fieldName.equals(methodGetterName)) { return method; } } return null; } private ClassUtils()...
@Test(expected = IllegalStateException.class) public void testCannotHaveErrors() { Document doc = new Document(); doc.setErrors(Arrays.asList(new ErrorDataBuilder().build())); doc.setData(Nullable.nullValue()); documentMapper.fromDocument(doc, false, queryContext); }
public Object fromDocument(Document document, boolean getList, QueryContext queryContext) { ControllerContext controllerContext = new ControllerContext(moduleRegistry, () -> this); ClientResourceUpsert upsert = new ClientResourceUpsert(proxyFactory); upsert.init(controllerContext); PreconditionUtil.verify(document.getE...
ClientDocumentMapper extends DocumentMapper { public Object fromDocument(Document document, boolean getList, QueryContext queryContext) { ControllerContext controllerContext = new ControllerContext(moduleRegistry, () -> this); ClientResourceUpsert upsert = new ClientResourceUpsert(proxyFactory); upsert.init(controllerC...
ClientDocumentMapper extends DocumentMapper { public Object fromDocument(Document document, boolean getList, QueryContext queryContext) { ControllerContext controllerContext = new ControllerContext(moduleRegistry, () -> this); ClientResourceUpsert upsert = new ClientResourceUpsert(proxyFactory); upsert.init(controllerC...
ClientDocumentMapper extends DocumentMapper { public Object fromDocument(Document document, boolean getList, QueryContext queryContext) { ControllerContext controllerContext = new ControllerContext(moduleRegistry, () -> this); ClientResourceUpsert upsert = new ClientResourceUpsert(proxyFactory); upsert.init(controllerC...
ClientDocumentMapper extends DocumentMapper { public Object fromDocument(Document document, boolean getList, QueryContext queryContext) { ControllerContext controllerContext = new ControllerContext(moduleRegistry, () -> this); ClientResourceUpsert upsert = new ClientResourceUpsert(proxyFactory); upsert.init(controllerC...
@Test public void testIsPrimitiveType() { assertThat(ClassUtils.isPrimitiveType(boolean.class)).isTrue(); assertThat(ClassUtils.isPrimitiveType(byte.class)).isTrue(); assertThat(ClassUtils.isPrimitiveType(short.class)).isTrue(); assertThat(ClassUtils.isPrimitiveType(int.class)).isTrue(); assertThat(ClassUtils.isPrimiti...
public static boolean isPrimitiveType(Class<?> type) { boolean isInt = type == byte.class || type == short.class || type == int.class || type == long.class; boolean isDecimal = type == short.class || type == double.class; return type == boolean.class || isInt || isDecimal; }
ClassUtils { public static boolean isPrimitiveType(Class<?> type) { boolean isInt = type == byte.class || type == short.class || type == int.class || type == long.class; boolean isDecimal = type == short.class || type == double.class; return type == boolean.class || isInt || isDecimal; } }
ClassUtils { public static boolean isPrimitiveType(Class<?> type) { boolean isInt = type == byte.class || type == short.class || type == int.class || type == long.class; boolean isDecimal = type == short.class || type == double.class; return type == boolean.class || isInt || isDecimal; } private ClassUtils(); }
ClassUtils { public static boolean isPrimitiveType(Class<?> type) { boolean isInt = type == byte.class || type == short.class || type == int.class || type == long.class; boolean isDecimal = type == short.class || type == double.class; return type == boolean.class || isInt || isDecimal; } private ClassUtils(); static b...
ClassUtils { public static boolean isPrimitiveType(Class<?> type) { boolean isInt = type == byte.class || type == short.class || type == int.class || type == long.class; boolean isDecimal = type == short.class || type == double.class; return type == boolean.class || isInt || isDecimal; } private ClassUtils(); static b...
@Test public void onNullValueShouldReturnNull() { PropertyUtilsTest.Bean bean = new PropertyUtilsTest.Bean(); Object result = BeanUtils.getProperty(bean, "publicProperty"); assertThat(result).isEqualTo("null"); }
public static String getProperty(Object bean, String field) { Object property = PropertyUtils.getProperty(bean, field); if (property == null) { return "null"; } return property.toString(); }
BeanUtils { public static String getProperty(Object bean, String field) { Object property = PropertyUtils.getProperty(bean, field); if (property == null) { return "null"; } return property.toString(); } }
BeanUtils { public static String getProperty(Object bean, String field) { Object property = PropertyUtils.getProperty(bean, field); if (property == null) { return "null"; } return property.toString(); } }
BeanUtils { public static String getProperty(Object bean, String field) { Object property = PropertyUtils.getProperty(bean, field); if (property == null) { return "null"; } return property.toString(); } static String getProperty(Object bean, String field); }
BeanUtils { public static String getProperty(Object bean, String field) { Object property = PropertyUtils.getProperty(bean, field); if (property == null) { return "null"; } return property.toString(); } static String getProperty(Object bean, String field); }
@Test public void onNonNullNullValueShouldReturnStringifiedProperty() { PropertyUtilsTest.Bean bean = new PropertyUtilsTest.Bean(); bean.setBooleanPrimitivePropertyWithMutators(true); Object result = BeanUtils.getProperty(bean, "booleanPrimitivePropertyWithMutators"); assertThat(result).isEqualTo("true"); }
public static String getProperty(Object bean, String field) { Object property = PropertyUtils.getProperty(bean, field); if (property == null) { return "null"; } return property.toString(); }
BeanUtils { public static String getProperty(Object bean, String field) { Object property = PropertyUtils.getProperty(bean, field); if (property == null) { return "null"; } return property.toString(); } }
BeanUtils { public static String getProperty(Object bean, String field) { Object property = PropertyUtils.getProperty(bean, field); if (property == null) { return "null"; } return property.toString(); } }
BeanUtils { public static String getProperty(Object bean, String field) { Object property = PropertyUtils.getProperty(bean, field); if (property == null) { return "null"; } return property.toString(); } static String getProperty(Object bean, String field); }
BeanUtils { public static String getProperty(Object bean, String field) { Object property = PropertyUtils.getProperty(bean, field); if (property == null) { return "null"; } return property.toString(); } static String getProperty(Object bean, String field); }
@Test public void testConstructorIsPrivate() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException { Constructor<PreconditionUtil> constructor = PreconditionUtil.class.getDeclaredConstructor(); Assert.assertTrue(Modifier.isPrivate(constructor.getModifiers())); construct...
public static void assertTrue(String message, boolean condition) { verify(condition, message); }
PreconditionUtil { public static void assertTrue(String message, boolean condition) { verify(condition, message); } }
PreconditionUtil { public static void assertTrue(String message, boolean condition) { verify(condition, message); } private PreconditionUtil(); }
PreconditionUtil { public static void assertTrue(String message, boolean condition) { verify(condition, message); } private PreconditionUtil(); static void assertEquals(String message, Object expected, Object actual); static void verifyEquals(Object expected, Object actual, String message, Object... args); static void...
PreconditionUtil { public static void assertTrue(String message, boolean condition) { verify(condition, message); } private PreconditionUtil(); static void assertEquals(String message, Object expected, Object actual); static void verifyEquals(Object expected, Object actual, String message, Object... args); static void...
@Test(expected = IllegalStateException.class) public void testObjectEqualsNotSatisfied() { PreconditionUtil.assertEquals("message", new Object(), new Object()); }
public static void assertEquals(String message, Object expected, Object actual) { verifyEquals(expected, actual, message); }
PreconditionUtil { public static void assertEquals(String message, Object expected, Object actual) { verifyEquals(expected, actual, message); } }
PreconditionUtil { public static void assertEquals(String message, Object expected, Object actual) { verifyEquals(expected, actual, message); } private PreconditionUtil(); }
PreconditionUtil { public static void assertEquals(String message, Object expected, Object actual) { verifyEquals(expected, actual, message); } private PreconditionUtil(); static void assertEquals(String message, Object expected, Object actual); static void verifyEquals(Object expected, Object actual, String message, ...
PreconditionUtil { public static void assertEquals(String message, Object expected, Object actual) { verifyEquals(expected, actual, message); } private PreconditionUtil(); static void assertEquals(String message, Object expected, Object actual); static void verifyEquals(Object expected, Object actual, String message, ...
@Test(expected = IllegalStateException.class) public void testEqualsNotSatisfied() { PreconditionUtil.assertEquals(null, 1, 2); }
public static void assertEquals(String message, Object expected, Object actual) { verifyEquals(expected, actual, message); }
PreconditionUtil { public static void assertEquals(String message, Object expected, Object actual) { verifyEquals(expected, actual, message); } }
PreconditionUtil { public static void assertEquals(String message, Object expected, Object actual) { verifyEquals(expected, actual, message); } private PreconditionUtil(); }
PreconditionUtil { public static void assertEquals(String message, Object expected, Object actual) { verifyEquals(expected, actual, message); } private PreconditionUtil(); static void assertEquals(String message, Object expected, Object actual); static void verifyEquals(Object expected, Object actual, String message, ...
PreconditionUtil { public static void assertEquals(String message, Object expected, Object actual) { verifyEquals(expected, actual, message); } private PreconditionUtil(); static void assertEquals(String message, Object expected, Object actual); static void verifyEquals(Object expected, Object actual, String message, ...
@Test(expected = IllegalStateException.class) public void testEqualsNotSatisfied2() { PreconditionUtil.assertEquals(null, "a", "b"); }
public static void assertEquals(String message, Object expected, Object actual) { verifyEquals(expected, actual, message); }
PreconditionUtil { public static void assertEquals(String message, Object expected, Object actual) { verifyEquals(expected, actual, message); } }
PreconditionUtil { public static void assertEquals(String message, Object expected, Object actual) { verifyEquals(expected, actual, message); } private PreconditionUtil(); }
PreconditionUtil { public static void assertEquals(String message, Object expected, Object actual) { verifyEquals(expected, actual, message); } private PreconditionUtil(); static void assertEquals(String message, Object expected, Object actual); static void verifyEquals(Object expected, Object actual, String message, ...
PreconditionUtil { public static void assertEquals(String message, Object expected, Object actual) { verifyEquals(expected, actual, message); } private PreconditionUtil(); static void assertEquals(String message, Object expected, Object actual); static void verifyEquals(Object expected, Object actual, String message, ...
@Test(expected = IllegalStateException.class) public void testTrueNotSatisfied() { PreconditionUtil.assertTrue(null, false); }
public static void assertTrue(String message, boolean condition) { verify(condition, message); }
PreconditionUtil { public static void assertTrue(String message, boolean condition) { verify(condition, message); } }
PreconditionUtil { public static void assertTrue(String message, boolean condition) { verify(condition, message); } private PreconditionUtil(); }
PreconditionUtil { public static void assertTrue(String message, boolean condition) { verify(condition, message); } private PreconditionUtil(); static void assertEquals(String message, Object expected, Object actual); static void verifyEquals(Object expected, Object actual, String message, Object... args); static void...
PreconditionUtil { public static void assertTrue(String message, boolean condition) { verify(condition, message); } private PreconditionUtil(); static void assertEquals(String message, Object expected, Object actual); static void verifyEquals(Object expected, Object actual, String message, Object... args); static void...
@Test(expected = IllegalStateException.class) public void testFalseNotSatisfied() { PreconditionUtil.assertFalse(null, true); }
public static void assertFalse(boolean condition, String message, Object... args) { verify(!condition, message, args); }
PreconditionUtil { public static void assertFalse(boolean condition, String message, Object... args) { verify(!condition, message, args); } }
PreconditionUtil { public static void assertFalse(boolean condition, String message, Object... args) { verify(!condition, message, args); } private PreconditionUtil(); }
PreconditionUtil { public static void assertFalse(boolean condition, String message, Object... args) { verify(!condition, message, args); } private PreconditionUtil(); static void assertEquals(String message, Object expected, Object actual); static void verifyEquals(Object expected, Object actual, String message, Obje...
PreconditionUtil { public static void assertFalse(boolean condition, String message, Object... args) { verify(!condition, message, args); } private PreconditionUtil(); static void assertEquals(String message, Object expected, Object actual); static void verifyEquals(Object expected, Object actual, String message, Obje...
@Test(expected = IllegalStateException.class) public void testNotNullNotSatisfied() { PreconditionUtil.assertNotNull(null, null); }
public static void assertNotNull(String message, Object object) { assertTrue(message, object != null); }
PreconditionUtil { public static void assertNotNull(String message, Object object) { assertTrue(message, object != null); } }
PreconditionUtil { public static void assertNotNull(String message, Object object) { assertTrue(message, object != null); } private PreconditionUtil(); }
PreconditionUtil { public static void assertNotNull(String message, Object object) { assertTrue(message, object != null); } private PreconditionUtil(); static void assertEquals(String message, Object expected, Object actual); static void verifyEquals(Object expected, Object actual, String message, Object... args); sta...
PreconditionUtil { public static void assertNotNull(String message, Object object) { assertTrue(message, object != null); } private PreconditionUtil(); static void assertEquals(String message, Object expected, Object actual); static void verifyEquals(Object expected, Object actual, String message, Object... args); sta...
@Test public void check404AndNoBodyGivesNotFoundException() throws IOException { HttpAdapterResponse response = Mockito.mock(HttpAdapterResponse.class); Mockito.when(response.body()).thenReturn(""); Mockito.when(response.code()).thenReturn(404); RuntimeException exception = stub.handleError(null, response); Assert.asse...
protected RuntimeException handleError(String url, HttpAdapterResponse response) throws IOException { RuntimeException e = handleError(client, response, client.getFormat()); if (e instanceof CrnkException) { CrnkException crnkException = (CrnkException) e; crnkException.setUrl(url); } return e; }
ClientStubBase { protected RuntimeException handleError(String url, HttpAdapterResponse response) throws IOException { RuntimeException e = handleError(client, response, client.getFormat()); if (e instanceof CrnkException) { CrnkException crnkException = (CrnkException) e; crnkException.setUrl(url); } return e; } }
ClientStubBase { protected RuntimeException handleError(String url, HttpAdapterResponse response) throws IOException { RuntimeException e = handleError(client, response, client.getFormat()); if (e instanceof CrnkException) { CrnkException crnkException = (CrnkException) e; crnkException.setUrl(url); } return e; } Clien...
ClientStubBase { protected RuntimeException handleError(String url, HttpAdapterResponse response) throws IOException { RuntimeException e = handleError(client, response, client.getFormat()); if (e instanceof CrnkException) { CrnkException crnkException = (CrnkException) e; crnkException.setUrl(url); } return e; } Clien...
ClientStubBase { protected RuntimeException handleError(String url, HttpAdapterResponse response) throws IOException { RuntimeException e = handleError(client, response, client.getFormat()); if (e instanceof CrnkException) { CrnkException crnkException = (CrnkException) e; crnkException.setUrl(url); } return e; } Clien...
@Test(expected = IllegalStateException.class) public void testNullNotSatisfied() { PreconditionUtil.assertNull(null, "not null"); }
public static void assertNull(String message, Object object) { assertTrue(message, object == null); }
PreconditionUtil { public static void assertNull(String message, Object object) { assertTrue(message, object == null); } }
PreconditionUtil { public static void assertNull(String message, Object object) { assertTrue(message, object == null); } private PreconditionUtil(); }
PreconditionUtil { public static void assertNull(String message, Object object) { assertTrue(message, object == null); } private PreconditionUtil(); static void assertEquals(String message, Object expected, Object actual); static void verifyEquals(Object expected, Object actual, String message, Object... args); static...
PreconditionUtil { public static void assertNull(String message, Object object) { assertTrue(message, object == null); } private PreconditionUtil(); static void assertEquals(String message, Object expected, Object actual); static void verifyEquals(Object expected, Object actual, String message, Object... args); static...
@Test public void test() { Assert.assertTrue(CompareUtils.isEquals("a", "a")); Assert.assertFalse(CompareUtils.isEquals(null, "a")); Assert.assertFalse(CompareUtils.isEquals("a", null)); Assert.assertTrue(CompareUtils.isEquals(null, null)); Assert.assertFalse(CompareUtils.isEquals("b", "a")); }
public static boolean isEquals(Object a, Object b) { return (a == b) || (a != null && a.equals(b)); }
CompareUtils { public static boolean isEquals(Object a, Object b) { return (a == b) || (a != null && a.equals(b)); } }
CompareUtils { public static boolean isEquals(Object a, Object b) { return (a == b) || (a != null && a.equals(b)); } private CompareUtils(); }
CompareUtils { public static boolean isEquals(Object a, Object b) { return (a == b) || (a != null && a.equals(b)); } private CompareUtils(); static boolean isEquals(Object a, Object b); }
CompareUtils { public static boolean isEquals(Object a, Object b) { return (a == b) || (a != null && a.equals(b)); } private CompareUtils(); static boolean isEquals(Object a, Object b); }
@Test public void testRemoveTrailingSlash() { Assert.assertNull(UrlUtils.removeTrailingSlash(null)); Assert.assertEquals("/test", UrlUtils.removeTrailingSlash("/test/")); Assert.assertEquals("test", UrlUtils.removeTrailingSlash("test/")); Assert.assertEquals("/test", UrlUtils.removeTrailingSlash("/test")); Assert.asser...
public static String removeTrailingSlash(String url) { if (url != null && url.endsWith("/")) { return url.substring(0, url.length() - 1); } else { return url; } }
UrlUtils { public static String removeTrailingSlash(String url) { if (url != null && url.endsWith("/")) { return url.substring(0, url.length() - 1); } else { return url; } } }
UrlUtils { public static String removeTrailingSlash(String url) { if (url != null && url.endsWith("/")) { return url.substring(0, url.length() - 1); } else { return url; } } private UrlUtils(); }
UrlUtils { public static String removeTrailingSlash(String url) { if (url != null && url.endsWith("/")) { return url.substring(0, url.length() - 1); } else { return url; } } private UrlUtils(); static String removeTrailingSlash(String url); static String addTrailingSlash(String url); static String removeLeadingSlash(S...
UrlUtils { public static String removeTrailingSlash(String url) { if (url != null && url.endsWith("/")) { return url.substring(0, url.length() - 1); } else { return url; } } private UrlUtils(); static String removeTrailingSlash(String url); static String addTrailingSlash(String url); static String removeLeadingSlash(S...
@Test public void testRemoveLeadingSlash() { Assert.assertNull(UrlUtils.removeLeadingSlash(null)); Assert.assertEquals("test/", UrlUtils.removeLeadingSlash("/test/")); Assert.assertEquals("test/", UrlUtils.removeLeadingSlash("test/")); Assert.assertEquals("test", UrlUtils.removeLeadingSlash("/test")); Assert.assertEqua...
public static String removeLeadingSlash(String url) { if (url != null && url.startsWith("/")) { return url.substring(1); } else { return url; } }
UrlUtils { public static String removeLeadingSlash(String url) { if (url != null && url.startsWith("/")) { return url.substring(1); } else { return url; } } }
UrlUtils { public static String removeLeadingSlash(String url) { if (url != null && url.startsWith("/")) { return url.substring(1); } else { return url; } } private UrlUtils(); }
UrlUtils { public static String removeLeadingSlash(String url) { if (url != null && url.startsWith("/")) { return url.substring(1); } else { return url; } } private UrlUtils(); static String removeTrailingSlash(String url); static String addTrailingSlash(String url); static String removeLeadingSlash(String url); stati...
UrlUtils { public static String removeLeadingSlash(String url) { if (url != null && url.startsWith("/")) { return url.substring(1); } else { return url; } } private UrlUtils(); static String removeTrailingSlash(String url); static String addTrailingSlash(String url); static String removeLeadingSlash(String url); stati...
@Test public void readFully() throws IOException { Random r = new Random(); for (int i = 0; i < 100; i++) { byte[] b = new byte[i * 100]; r.nextBytes(b); Assert.assertTrue(Arrays.equals(b, IOUtils.readFully(new ByteArrayInputStream(b)))); } }
public static byte[] readFully(InputStream is) throws IOException { int nRead; ByteArrayOutputStream buffer = new ByteArrayOutputStream(); byte[] data = new byte[16384]; while ((nRead = is.read(data, 0, data.length)) != -1) { buffer.write(data, 0, nRead); } buffer.flush(); return buffer.toByteArray(); }
IOUtils { public static byte[] readFully(InputStream is) throws IOException { int nRead; ByteArrayOutputStream buffer = new ByteArrayOutputStream(); byte[] data = new byte[16384]; while ((nRead = is.read(data, 0, data.length)) != -1) { buffer.write(data, 0, nRead); } buffer.flush(); return buffer.toByteArray(); } }
IOUtils { public static byte[] readFully(InputStream is) throws IOException { int nRead; ByteArrayOutputStream buffer = new ByteArrayOutputStream(); byte[] data = new byte[16384]; while ((nRead = is.read(data, 0, data.length)) != -1) { buffer.write(data, 0, nRead); } buffer.flush(); return buffer.toByteArray(); } priva...
IOUtils { public static byte[] readFully(InputStream is) throws IOException { int nRead; ByteArrayOutputStream buffer = new ByteArrayOutputStream(); byte[] data = new byte[16384]; while ((nRead = is.read(data, 0, data.length)) != -1) { buffer.write(data, 0, nRead); } buffer.flush(); return buffer.toByteArray(); } priva...
IOUtils { public static byte[] readFully(InputStream is) throws IOException { int nRead; ByteArrayOutputStream buffer = new ByteArrayOutputStream(); byte[] data = new byte[16384]; while ((nRead = is.read(data, 0, data.length)) != -1) { buffer.write(data, 0, nRead); } buffer.flush(); return buffer.toByteArray(); } priva...
@Test public void test() { QuerySpec querySpec = new QuerySpec(Task.class); querySpec.addFilter(PathSpec.of("name").filter(FilterOperator.EQ, "bar")); Assert.assertEquals("http: Assert.assertEquals("http: Assert.assertEquals("http: Assert.assertEquals("http: }
@Override public String buildUrl(QueryContext queryContext, Object resource) { RegistryEntry entry = moduleRegistry.getResourceRegistry().findEntry(resource); ResourceInformation resourceInformation = entry.getResourceInformation(); Object id = resourceInformation.getId(resource); return buildUrl(queryContext, resource...
JsonApiUrlBuilder implements UrlBuilder { @Override public String buildUrl(QueryContext queryContext, Object resource) { RegistryEntry entry = moduleRegistry.getResourceRegistry().findEntry(resource); ResourceInformation resourceInformation = entry.getResourceInformation(); Object id = resourceInformation.getId(resourc...
JsonApiUrlBuilder implements UrlBuilder { @Override public String buildUrl(QueryContext queryContext, Object resource) { RegistryEntry entry = moduleRegistry.getResourceRegistry().findEntry(resource); ResourceInformation resourceInformation = entry.getResourceInformation(); Object id = resourceInformation.getId(resourc...
JsonApiUrlBuilder implements UrlBuilder { @Override public String buildUrl(QueryContext queryContext, Object resource) { RegistryEntry entry = moduleRegistry.getResourceRegistry().findEntry(resource); ResourceInformation resourceInformation = entry.getResourceInformation(); Object id = resourceInformation.getId(resourc...
JsonApiUrlBuilder implements UrlBuilder { @Override public String buildUrl(QueryContext queryContext, Object resource) { RegistryEntry entry = moduleRegistry.getResourceRegistry().findEntry(resource); ResourceInformation resourceInformation = entry.getResourceInformation(); Object id = resourceInformation.getId(resourc...
@Test public void testMethod() { MethodCache cache = new MethodCache(); Optional<Method> method = cache.find(Date.class, "parse", String.class); Assert.assertTrue(method.isPresent()); Assert.assertEquals("parse", method.get().getName()); Optional<Method> method2 = cache.find(Date.class, "parse", String.class); Assert.a...
public Optional<Method> find(Class<?> clazz, String name, Class<?>... parameters) { MethodCacheKey entry = new MethodCacheKey(clazz, name, parameters); Optional<Method> method = cache.get(entry); if (method == null) { try { method = Optional.of(clazz.getMethod(name, parameters)); } catch (NoSuchMethodException e) { met...
MethodCache { public Optional<Method> find(Class<?> clazz, String name, Class<?>... parameters) { MethodCacheKey entry = new MethodCacheKey(clazz, name, parameters); Optional<Method> method = cache.get(entry); if (method == null) { try { method = Optional.of(clazz.getMethod(name, parameters)); } catch (NoSuchMethodExce...
MethodCache { public Optional<Method> find(Class<?> clazz, String name, Class<?>... parameters) { MethodCacheKey entry = new MethodCacheKey(clazz, name, parameters); Optional<Method> method = cache.get(entry); if (method == null) { try { method = Optional.of(clazz.getMethod(name, parameters)); } catch (NoSuchMethodExce...
MethodCache { public Optional<Method> find(Class<?> clazz, String name, Class<?>... parameters) { MethodCacheKey entry = new MethodCacheKey(clazz, name, parameters); Optional<Method> method = cache.get(entry); if (method == null) { try { method = Optional.of(clazz.getMethod(name, parameters)); } catch (NoSuchMethodExce...
MethodCache { public Optional<Method> find(Class<?> clazz, String name, Class<?>... parameters) { MethodCacheKey entry = new MethodCacheKey(clazz, name, parameters); Optional<Method> method = cache.get(entry); if (method == null) { try { method = Optional.of(clazz.getMethod(name, parameters)); } catch (NoSuchMethodExce...
@Test public void testNonExistingMethod() { MethodCache cache = new MethodCache(); Optional<Method> method = cache.find(Date.class, "doesNotExist", String.class); Assert.assertFalse(method.isPresent()); }
public Optional<Method> find(Class<?> clazz, String name, Class<?>... parameters) { MethodCacheKey entry = new MethodCacheKey(clazz, name, parameters); Optional<Method> method = cache.get(entry); if (method == null) { try { method = Optional.of(clazz.getMethod(name, parameters)); } catch (NoSuchMethodException e) { met...
MethodCache { public Optional<Method> find(Class<?> clazz, String name, Class<?>... parameters) { MethodCacheKey entry = new MethodCacheKey(clazz, name, parameters); Optional<Method> method = cache.get(entry); if (method == null) { try { method = Optional.of(clazz.getMethod(name, parameters)); } catch (NoSuchMethodExce...
MethodCache { public Optional<Method> find(Class<?> clazz, String name, Class<?>... parameters) { MethodCacheKey entry = new MethodCacheKey(clazz, name, parameters); Optional<Method> method = cache.get(entry); if (method == null) { try { method = Optional.of(clazz.getMethod(name, parameters)); } catch (NoSuchMethodExce...
MethodCache { public Optional<Method> find(Class<?> clazz, String name, Class<?>... parameters) { MethodCacheKey entry = new MethodCacheKey(clazz, name, parameters); Optional<Method> method = cache.get(entry); if (method == null) { try { method = Optional.of(clazz.getMethod(name, parameters)); } catch (NoSuchMethodExce...
MethodCache { public Optional<Method> find(Class<?> clazz, String name, Class<?>... parameters) { MethodCacheKey entry = new MethodCacheKey(clazz, name, parameters); Optional<Method> method = cache.get(entry); if (method == null) { try { method = Optional.of(clazz.getMethod(name, parameters)); } catch (NoSuchMethodExce...
@Test public void onValidRequestShouldAcceptIt() { JsonPath jsonPath = pathBuilder.build("tasks/1", queryContext); ResourceDeleteController sut = new ResourceDeleteController(); sut.init(controllerContext); boolean result = sut.isAcceptable(jsonPath, REQUEST_TYPE); assertThat(result).isTrue(); }
@Override public boolean isAcceptable(JsonPath jsonPath, String method) { return jsonPath instanceof ResourcePath && HttpMethod.DELETE.name().equals(method); }
ResourceDeleteController extends BaseController { @Override public boolean isAcceptable(JsonPath jsonPath, String method) { return jsonPath instanceof ResourcePath && HttpMethod.DELETE.name().equals(method); } }
ResourceDeleteController extends BaseController { @Override public boolean isAcceptable(JsonPath jsonPath, String method) { return jsonPath instanceof ResourcePath && HttpMethod.DELETE.name().equals(method); } }
ResourceDeleteController extends BaseController { @Override public boolean isAcceptable(JsonPath jsonPath, String method) { return jsonPath instanceof ResourcePath && HttpMethod.DELETE.name().equals(method); } @Override boolean isAcceptable(JsonPath jsonPath, String method); @Override Result<Response> handleAsync(Json...
ResourceDeleteController extends BaseController { @Override public boolean isAcceptable(JsonPath jsonPath, String method) { return jsonPath instanceof ResourcePath && HttpMethod.DELETE.name().equals(method); } @Override boolean isAcceptable(JsonPath jsonPath, String method); @Override Result<Response> handleAsync(Json...
@Test public void onNonRelationRequestShouldDenyIt() { JsonPath jsonPath = pathBuilder.build("tasks/1/relationships/project", queryContext); ResourceDeleteController sut = new ResourceDeleteController(); sut.init(controllerContext); boolean result = sut.isAcceptable(jsonPath, REQUEST_TYPE); assertThat(result).isFalse()...
@Override public boolean isAcceptable(JsonPath jsonPath, String method) { return jsonPath instanceof ResourcePath && HttpMethod.DELETE.name().equals(method); }
ResourceDeleteController extends BaseController { @Override public boolean isAcceptable(JsonPath jsonPath, String method) { return jsonPath instanceof ResourcePath && HttpMethod.DELETE.name().equals(method); } }
ResourceDeleteController extends BaseController { @Override public boolean isAcceptable(JsonPath jsonPath, String method) { return jsonPath instanceof ResourcePath && HttpMethod.DELETE.name().equals(method); } }
ResourceDeleteController extends BaseController { @Override public boolean isAcceptable(JsonPath jsonPath, String method) { return jsonPath instanceof ResourcePath && HttpMethod.DELETE.name().equals(method); } @Override boolean isAcceptable(JsonPath jsonPath, String method); @Override Result<Response> handleAsync(Json...
ResourceDeleteController extends BaseController { @Override public boolean isAcceptable(JsonPath jsonPath, String method) { return jsonPath instanceof ResourcePath && HttpMethod.DELETE.name().equals(method); } @Override boolean isAcceptable(JsonPath jsonPath, String method); @Override Result<Response> handleAsync(Json...
@Test public void check500AndNoBodyGivesInternalServerErrorException() throws IOException { HttpAdapterResponse response = Mockito.mock(HttpAdapterResponse.class); Mockito.when(response.body()).thenReturn(""); Mockito.when(response.code()).thenReturn(500); RuntimeException exception = stub.handleError(null, response); ...
protected RuntimeException handleError(String url, HttpAdapterResponse response) throws IOException { RuntimeException e = handleError(client, response, client.getFormat()); if (e instanceof CrnkException) { CrnkException crnkException = (CrnkException) e; crnkException.setUrl(url); } return e; }
ClientStubBase { protected RuntimeException handleError(String url, HttpAdapterResponse response) throws IOException { RuntimeException e = handleError(client, response, client.getFormat()); if (e instanceof CrnkException) { CrnkException crnkException = (CrnkException) e; crnkException.setUrl(url); } return e; } }
ClientStubBase { protected RuntimeException handleError(String url, HttpAdapterResponse response) throws IOException { RuntimeException e = handleError(client, response, client.getFormat()); if (e instanceof CrnkException) { CrnkException crnkException = (CrnkException) e; crnkException.setUrl(url); } return e; } Clien...
ClientStubBase { protected RuntimeException handleError(String url, HttpAdapterResponse response) throws IOException { RuntimeException e = handleError(client, response, client.getFormat()); if (e instanceof CrnkException) { CrnkException crnkException = (CrnkException) e; crnkException.setUrl(url); } return e; } Clien...
ClientStubBase { protected RuntimeException handleError(String url, HttpAdapterResponse response) throws IOException { RuntimeException e = handleError(client, response, client.getFormat()); if (e instanceof CrnkException) { CrnkException crnkException = (CrnkException) e; crnkException.setUrl(url); } return e; } Clien...
@Test public void onGivenRequestCollectionGetShouldAcceptIt() { JsonPath jsonPath = pathBuilder.build("/tasks/", queryContext); CollectionGetController sut = new CollectionGetController(); sut.init(controllerContext); boolean result = sut.isAcceptable(jsonPath, REQUEST_TYPE); Assert.assertEquals(result, true); }
@Override public boolean isAcceptable(JsonPath jsonPath, String method) { return jsonPath.isCollection() && jsonPath instanceof ResourcePath && HttpMethod.GET.name().equals(method); }
CollectionGetController extends ResourceIncludeField { @Override public boolean isAcceptable(JsonPath jsonPath, String method) { return jsonPath.isCollection() && jsonPath instanceof ResourcePath && HttpMethod.GET.name().equals(method); } }
CollectionGetController extends ResourceIncludeField { @Override public boolean isAcceptable(JsonPath jsonPath, String method) { return jsonPath.isCollection() && jsonPath instanceof ResourcePath && HttpMethod.GET.name().equals(method); } }
CollectionGetController extends ResourceIncludeField { @Override public boolean isAcceptable(JsonPath jsonPath, String method) { return jsonPath.isCollection() && jsonPath instanceof ResourcePath && HttpMethod.GET.name().equals(method); } @Override boolean isAcceptable(JsonPath jsonPath, String method); @Override Resu...
CollectionGetController extends ResourceIncludeField { @Override public boolean isAcceptable(JsonPath jsonPath, String method) { return jsonPath.isCollection() && jsonPath instanceof ResourcePath && HttpMethod.GET.name().equals(method); } @Override boolean isAcceptable(JsonPath jsonPath, String method); @Override Resu...
@Test public void onGivenRequestCollectionGetShouldDenyIt() { JsonPath jsonPath = pathBuilder.build("/tasks/2", queryContext); CollectionGetController sut = new CollectionGetController(); sut.init(controllerContext); boolean result = sut.isAcceptable(jsonPath, REQUEST_TYPE); Assert.assertEquals(result, false); }
@Override public boolean isAcceptable(JsonPath jsonPath, String method) { return jsonPath.isCollection() && jsonPath instanceof ResourcePath && HttpMethod.GET.name().equals(method); }
CollectionGetController extends ResourceIncludeField { @Override public boolean isAcceptable(JsonPath jsonPath, String method) { return jsonPath.isCollection() && jsonPath instanceof ResourcePath && HttpMethod.GET.name().equals(method); } }
CollectionGetController extends ResourceIncludeField { @Override public boolean isAcceptable(JsonPath jsonPath, String method) { return jsonPath.isCollection() && jsonPath instanceof ResourcePath && HttpMethod.GET.name().equals(method); } }
CollectionGetController extends ResourceIncludeField { @Override public boolean isAcceptable(JsonPath jsonPath, String method) { return jsonPath.isCollection() && jsonPath instanceof ResourcePath && HttpMethod.GET.name().equals(method); } @Override boolean isAcceptable(JsonPath jsonPath, String method); @Override Resu...
CollectionGetController extends ResourceIncludeField { @Override public boolean isAcceptable(JsonPath jsonPath, String method) { return jsonPath.isCollection() && jsonPath instanceof ResourcePath && HttpMethod.GET.name().equals(method); } @Override boolean isAcceptable(JsonPath jsonPath, String method); @Override Resu...
@Test public void onGivenRequestCollectionGetShouldDenyIt() { JsonPath jsonPath = pathBuilder.build("/tasks/", queryContext); ResourceGetController sut = new ResourceGetController(); sut.init(controllerContext); boolean result = sut.isAcceptable(jsonPath, REQUEST_TYPE); Assert.assertEquals(result, false); }
@Override public boolean isAcceptable(JsonPath jsonPath, String method) { return !jsonPath.isCollection() && jsonPath instanceof ResourcePath && HttpMethod.GET.name().equals(method); }
ResourceGetController extends ResourceIncludeField { @Override public boolean isAcceptable(JsonPath jsonPath, String method) { return !jsonPath.isCollection() && jsonPath instanceof ResourcePath && HttpMethod.GET.name().equals(method); } }
ResourceGetController extends ResourceIncludeField { @Override public boolean isAcceptable(JsonPath jsonPath, String method) { return !jsonPath.isCollection() && jsonPath instanceof ResourcePath && HttpMethod.GET.name().equals(method); } }
ResourceGetController extends ResourceIncludeField { @Override public boolean isAcceptable(JsonPath jsonPath, String method) { return !jsonPath.isCollection() && jsonPath instanceof ResourcePath && HttpMethod.GET.name().equals(method); } @Override boolean isAcceptable(JsonPath jsonPath, String method); @Override Resul...
ResourceGetController extends ResourceIncludeField { @Override public boolean isAcceptable(JsonPath jsonPath, String method) { return !jsonPath.isCollection() && jsonPath instanceof ResourcePath && HttpMethod.GET.name().equals(method); } @Override boolean isAcceptable(JsonPath jsonPath, String method); @Override Resul...
@Test public void onGivenRequestResourceGetShouldAcceptIt() { JsonPath jsonPath = pathBuilder.build("/tasks/2", queryContext); ResourceGetController sut = new ResourceGetController(); sut.init(controllerContext); boolean result = sut.isAcceptable(jsonPath, REQUEST_TYPE); Assert.assertEquals(result, true); }
@Override public boolean isAcceptable(JsonPath jsonPath, String method) { return !jsonPath.isCollection() && jsonPath instanceof ResourcePath && HttpMethod.GET.name().equals(method); }
ResourceGetController extends ResourceIncludeField { @Override public boolean isAcceptable(JsonPath jsonPath, String method) { return !jsonPath.isCollection() && jsonPath instanceof ResourcePath && HttpMethod.GET.name().equals(method); } }
ResourceGetController extends ResourceIncludeField { @Override public boolean isAcceptable(JsonPath jsonPath, String method) { return !jsonPath.isCollection() && jsonPath instanceof ResourcePath && HttpMethod.GET.name().equals(method); } }
ResourceGetController extends ResourceIncludeField { @Override public boolean isAcceptable(JsonPath jsonPath, String method) { return !jsonPath.isCollection() && jsonPath instanceof ResourcePath && HttpMethod.GET.name().equals(method); } @Override boolean isAcceptable(JsonPath jsonPath, String method); @Override Resul...
ResourceGetController extends ResourceIncludeField { @Override public boolean isAcceptable(JsonPath jsonPath, String method) { return !jsonPath.isCollection() && jsonPath instanceof ResourcePath && HttpMethod.GET.name().equals(method); } @Override boolean isAcceptable(JsonPath jsonPath, String method); @Override Resul...
@Test public void onMethodMismatchShouldDenyIt() { JsonPath jsonPath = pathBuilder.build("/tasks/2", queryContext); ResourceGetController sut = new ResourceGetController(); sut.init(controllerContext); boolean result = sut.isAcceptable(jsonPath, "POST"); Assert.assertEquals(result, false); }
@Override public boolean isAcceptable(JsonPath jsonPath, String method) { return !jsonPath.isCollection() && jsonPath instanceof ResourcePath && HttpMethod.GET.name().equals(method); }
ResourceGetController extends ResourceIncludeField { @Override public boolean isAcceptable(JsonPath jsonPath, String method) { return !jsonPath.isCollection() && jsonPath instanceof ResourcePath && HttpMethod.GET.name().equals(method); } }
ResourceGetController extends ResourceIncludeField { @Override public boolean isAcceptable(JsonPath jsonPath, String method) { return !jsonPath.isCollection() && jsonPath instanceof ResourcePath && HttpMethod.GET.name().equals(method); } }
ResourceGetController extends ResourceIncludeField { @Override public boolean isAcceptable(JsonPath jsonPath, String method) { return !jsonPath.isCollection() && jsonPath instanceof ResourcePath && HttpMethod.GET.name().equals(method); } @Override boolean isAcceptable(JsonPath jsonPath, String method); @Override Resul...
ResourceGetController extends ResourceIncludeField { @Override public boolean isAcceptable(JsonPath jsonPath, String method) { return !jsonPath.isCollection() && jsonPath instanceof ResourcePath && HttpMethod.GET.name().equals(method); } @Override boolean isAcceptable(JsonPath jsonPath, String method); @Override Resul...
@Test public void onGivenRequestCollectionGetShouldDenyIt() { JsonPath jsonPath = pathBuilder.build("/tasks/1", queryContext); ResourcePostController sut = new ResourcePostController(); sut.init(controllerContext); boolean result = sut.isAcceptable(jsonPath, REQUEST_TYPE); Assert.assertEquals(result, false); }
@Override public boolean isAcceptable(JsonPath jsonPath, String method) { boolean nestedOne = jsonPath.getParentField() != null && !jsonPath.getParentField().isCollection(); return (jsonPath.isCollection() || nestedOne) && jsonPath instanceof ResourcePath && HttpMethod.POST.name().equals(method); }
ResourcePostController extends ResourceUpsert { @Override public boolean isAcceptable(JsonPath jsonPath, String method) { boolean nestedOne = jsonPath.getParentField() != null && !jsonPath.getParentField().isCollection(); return (jsonPath.isCollection() || nestedOne) && jsonPath instanceof ResourcePath && HttpMethod.PO...
ResourcePostController extends ResourceUpsert { @Override public boolean isAcceptable(JsonPath jsonPath, String method) { boolean nestedOne = jsonPath.getParentField() != null && !jsonPath.getParentField().isCollection(); return (jsonPath.isCollection() || nestedOne) && jsonPath instanceof ResourcePath && HttpMethod.PO...
ResourcePostController extends ResourceUpsert { @Override public boolean isAcceptable(JsonPath jsonPath, String method) { boolean nestedOne = jsonPath.getParentField() != null && !jsonPath.getParentField().isCollection(); return (jsonPath.isCollection() || nestedOne) && jsonPath instanceof ResourcePath && HttpMethod.PO...
ResourcePostController extends ResourceUpsert { @Override public boolean isAcceptable(JsonPath jsonPath, String method) { boolean nestedOne = jsonPath.getParentField() != null && !jsonPath.getParentField().isCollection(); return (jsonPath.isCollection() || nestedOne) && jsonPath instanceof ResourcePath && HttpMethod.PO...
@Test public void onGivenRequestResourceGetShouldAcceptIt() { JsonPath jsonPath = pathBuilder.build("/tasks/", queryContext); ResourcePostController sut = new ResourcePostController(); sut.init(controllerContext); boolean result = sut.isAcceptable(jsonPath, REQUEST_TYPE); Assert.assertEquals(result, true); }
@Override public boolean isAcceptable(JsonPath jsonPath, String method) { boolean nestedOne = jsonPath.getParentField() != null && !jsonPath.getParentField().isCollection(); return (jsonPath.isCollection() || nestedOne) && jsonPath instanceof ResourcePath && HttpMethod.POST.name().equals(method); }
ResourcePostController extends ResourceUpsert { @Override public boolean isAcceptable(JsonPath jsonPath, String method) { boolean nestedOne = jsonPath.getParentField() != null && !jsonPath.getParentField().isCollection(); return (jsonPath.isCollection() || nestedOne) && jsonPath instanceof ResourcePath && HttpMethod.PO...
ResourcePostController extends ResourceUpsert { @Override public boolean isAcceptable(JsonPath jsonPath, String method) { boolean nestedOne = jsonPath.getParentField() != null && !jsonPath.getParentField().isCollection(); return (jsonPath.isCollection() || nestedOne) && jsonPath instanceof ResourcePath && HttpMethod.PO...
ResourcePostController extends ResourceUpsert { @Override public boolean isAcceptable(JsonPath jsonPath, String method) { boolean nestedOne = jsonPath.getParentField() != null && !jsonPath.getParentField().isCollection(); return (jsonPath.isCollection() || nestedOne) && jsonPath instanceof ResourcePath && HttpMethod.PO...
ResourcePostController extends ResourceUpsert { @Override public boolean isAcceptable(JsonPath jsonPath, String method) { boolean nestedOne = jsonPath.getParentField() != null && !jsonPath.getParentField().isCollection(); return (jsonPath.isCollection() || nestedOne) && jsonPath instanceof ResourcePath && HttpMethod.PO...
@Test public void onGivenRequestCollectionGetShouldDenyIt() { JsonPath jsonPath = pathBuilder.build("/tasks/", queryContext); ResourcePatchController sut = new ResourcePatchController(); sut.init(controllerContext); boolean result = sut.isAcceptable(jsonPath, REQUEST_TYPE); Assert.assertEquals(result, false); }
@Override public boolean isAcceptable(JsonPath jsonPath, String method) { return !jsonPath.isCollection() && jsonPath instanceof ResourcePath && HttpMethod.PATCH.name().equals(method); }
ResourcePatchController extends ResourceUpsert { @Override public boolean isAcceptable(JsonPath jsonPath, String method) { return !jsonPath.isCollection() && jsonPath instanceof ResourcePath && HttpMethod.PATCH.name().equals(method); } }
ResourcePatchController extends ResourceUpsert { @Override public boolean isAcceptable(JsonPath jsonPath, String method) { return !jsonPath.isCollection() && jsonPath instanceof ResourcePath && HttpMethod.PATCH.name().equals(method); } }
ResourcePatchController extends ResourceUpsert { @Override public boolean isAcceptable(JsonPath jsonPath, String method) { return !jsonPath.isCollection() && jsonPath instanceof ResourcePath && HttpMethod.PATCH.name().equals(method); } @Override boolean isAcceptable(JsonPath jsonPath, String method); @Override Result<...
ResourcePatchController extends ResourceUpsert { @Override public boolean isAcceptable(JsonPath jsonPath, String method) { return !jsonPath.isCollection() && jsonPath instanceof ResourcePath && HttpMethod.PATCH.name().equals(method); } @Override boolean isAcceptable(JsonPath jsonPath, String method); @Override Result<...
@Test public void onGivenRequestResourceGetShouldAcceptIt() { JsonPath jsonPath = pathBuilder.build("/tasks/1", queryContext); ResourcePatchController sut = new ResourcePatchController(); sut.init(controllerContext); boolean result = sut.isAcceptable(jsonPath, REQUEST_TYPE); Assert.assertEquals(result, true); }
@Override public boolean isAcceptable(JsonPath jsonPath, String method) { return !jsonPath.isCollection() && jsonPath instanceof ResourcePath && HttpMethod.PATCH.name().equals(method); }
ResourcePatchController extends ResourceUpsert { @Override public boolean isAcceptable(JsonPath jsonPath, String method) { return !jsonPath.isCollection() && jsonPath instanceof ResourcePath && HttpMethod.PATCH.name().equals(method); } }
ResourcePatchController extends ResourceUpsert { @Override public boolean isAcceptable(JsonPath jsonPath, String method) { return !jsonPath.isCollection() && jsonPath instanceof ResourcePath && HttpMethod.PATCH.name().equals(method); } }
ResourcePatchController extends ResourceUpsert { @Override public boolean isAcceptable(JsonPath jsonPath, String method) { return !jsonPath.isCollection() && jsonPath instanceof ResourcePath && HttpMethod.PATCH.name().equals(method); } @Override boolean isAcceptable(JsonPath jsonPath, String method); @Override Result<...
ResourcePatchController extends ResourceUpsert { @Override public boolean isAcceptable(JsonPath jsonPath, String method) { return !jsonPath.isCollection() && jsonPath instanceof ResourcePath && HttpMethod.PATCH.name().equals(method); } @Override boolean isAcceptable(JsonPath jsonPath, String method); @Override Result<...
@Test public void onEmptyPathReturnsNull() { String path = "/"; JsonPath jsonPath = pathBuilder.build(path, queryContext); assertThat(jsonPath).isNull(); }
public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Arrays.asList(pathE...
PathBuilder { public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Array...
PathBuilder { public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Array...
PathBuilder { public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Array...
PathBuilder { public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Array...
@Test public void checkCheckedException() throws IOException { HttpAdapterResponse response = Mockito.mock(HttpAdapterResponse.class); Mockito.when(response.body()).thenReturn(""); Mockito.when(response.code()).thenReturn(599); RuntimeException exception = stub.handleError(null, response); Assert.assertTrue(exception i...
protected RuntimeException handleError(String url, HttpAdapterResponse response) throws IOException { RuntimeException e = handleError(client, response, client.getFormat()); if (e instanceof CrnkException) { CrnkException crnkException = (CrnkException) e; crnkException.setUrl(url); } return e; }
ClientStubBase { protected RuntimeException handleError(String url, HttpAdapterResponse response) throws IOException { RuntimeException e = handleError(client, response, client.getFormat()); if (e instanceof CrnkException) { CrnkException crnkException = (CrnkException) e; crnkException.setUrl(url); } return e; } }
ClientStubBase { protected RuntimeException handleError(String url, HttpAdapterResponse response) throws IOException { RuntimeException e = handleError(client, response, client.getFormat()); if (e instanceof CrnkException) { CrnkException crnkException = (CrnkException) e; crnkException.setUrl(url); } return e; } Clien...
ClientStubBase { protected RuntimeException handleError(String url, HttpAdapterResponse response) throws IOException { RuntimeException e = handleError(client, response, client.getFormat()); if (e instanceof CrnkException) { CrnkException crnkException = (CrnkException) e; crnkException.setUrl(url); } return e; } Clien...
ClientStubBase { protected RuntimeException handleError(String url, HttpAdapterResponse response) throws IOException { RuntimeException e = handleError(client, response, client.getFormat()); if (e instanceof CrnkException) { CrnkException crnkException = (CrnkException) e; crnkException.setUrl(url); } return e; } Clien...
@Test public void onNestedResourceInstancePathShouldThrowException() { String path = "/tasks/1/project/2"; expectedException.expect(BadRequestException.class); pathBuilder.build(path, queryContext); }
public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Arrays.asList(pathE...
PathBuilder { public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Array...
PathBuilder { public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Array...
PathBuilder { public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Array...
PathBuilder { public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Array...
@Test public void onNonRelationshipFieldShouldThrowException() { String path = "/tasks/1/relationships/name/"; expectedException.expect(BadRequestException.class); pathBuilder.build(path, queryContext); }
public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Arrays.asList(pathE...
PathBuilder { public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Array...
PathBuilder { public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Array...
PathBuilder { public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Array...
PathBuilder { public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Array...
@Test public void onRelationshipFieldInRelationshipsShouldThrowException() { String path = "/users/1/relationships/projects"; expectedException.expect(BadRequestException.class); expectedException.expectMessage("projects"); pathBuilder.build(path, queryContext); }
public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Arrays.asList(pathE...
PathBuilder { public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Array...
PathBuilder { public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Array...
PathBuilder { public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Array...
PathBuilder { public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Array...
@Test public void onNestedWrongResourceRelationshipPathShouldThrowException() { String path = "/tasks/1/relationships/"; expectedException.expect(BadRequestException.class); pathBuilder.build(path, queryContext); }
public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Arrays.asList(pathE...
PathBuilder { public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Array...
PathBuilder { public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Array...
PathBuilder { public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Array...
PathBuilder { public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Array...
@Test public void onRelationshipsPathWithIdShouldThrowException() { String path = "/tasks/1/relationships/project/1"; expectedException.expect(BadRequestException.class); pathBuilder.build(path, queryContext); }
public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Arrays.asList(pathE...
PathBuilder { public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Array...
PathBuilder { public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Array...
PathBuilder { public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Array...
PathBuilder { public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Array...
@Test public void onNonExistingFieldShouldThrowException() { String path = "/tasks/1/nonExistingField/"; expectedException.expect(BadRequestException.class); expectedException.expectMessage("nonExistingField"); pathBuilder.build(path, queryContext); }
public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Arrays.asList(pathE...
PathBuilder { public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Array...
PathBuilder { public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Array...
PathBuilder { public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Array...
PathBuilder { public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Array...
@Test public void onNonExistingResourceShouldThrowException() { String path = "/nonExistingResource"; Assert.assertNull(pathBuilder.build(path, queryContext)); }
public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Arrays.asList(pathE...
PathBuilder { public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Array...
PathBuilder { public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Array...
PathBuilder { public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Array...
PathBuilder { public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Array...
@Test public void onResourceStaringWithRelationshipsShouldThrowException() { String path = "/relationships"; Assert.assertNull(pathBuilder.build(path, queryContext)); }
public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Arrays.asList(pathE...
PathBuilder { public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Array...
PathBuilder { public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Array...
PathBuilder { public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Array...
PathBuilder { public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Array...
@Test public void ignoreEntriesNotBeingExposed() { String path = "/notExposed/1/"; JsonPath jsonPath = pathBuilder.build(path, queryContext); Assert.assertNull(jsonPath); }
public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Arrays.asList(pathE...
PathBuilder { public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Array...
PathBuilder { public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Array...
PathBuilder { public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Array...
PathBuilder { public JsonPath build(String path, QueryContext queryContext) { String[] pathElements = splitPath(path); if (pathElements.length == 0 || (pathElements.length == 1 && "".equals(pathElements[0]))) { LOGGER.debug("requested root path: {}", path); return null; } return parseResourcePath(new LinkedList<>(Array...
@Test(expected = ParserException.class) public void onInvalidCharacterThrowException() { sut.parse("NOT a single character", Character.class); }
public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; }
TypeParser { public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; } }
TypeParser { public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; } TypeParser(); }
TypeParser { public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; } TypeParser(); boolean isEnforceJackson(); void setEnforceJackson(boolean enforceJackson); boolean...
TypeParser { public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; } TypeParser(); boolean isEnforceJackson(); void setEnforceJackson(boolean enforceJackson); boolean...
@Test public void checkBodyWithNoErrorsAnd500Status() throws IOException { Document document = new Document(); document.setErrors(new ArrayList<ErrorData>()); String body = client.getObjectMapper().writeValueAsString(document); HttpAdapterResponse response = Mockito.mock(HttpAdapterResponse.class); Mockito.when(respons...
protected RuntimeException handleError(String url, HttpAdapterResponse response) throws IOException { RuntimeException e = handleError(client, response, client.getFormat()); if (e instanceof CrnkException) { CrnkException crnkException = (CrnkException) e; crnkException.setUrl(url); } return e; }
ClientStubBase { protected RuntimeException handleError(String url, HttpAdapterResponse response) throws IOException { RuntimeException e = handleError(client, response, client.getFormat()); if (e instanceof CrnkException) { CrnkException crnkException = (CrnkException) e; crnkException.setUrl(url); } return e; } }
ClientStubBase { protected RuntimeException handleError(String url, HttpAdapterResponse response) throws IOException { RuntimeException e = handleError(client, response, client.getFormat()); if (e instanceof CrnkException) { CrnkException crnkException = (CrnkException) e; crnkException.setUrl(url); } return e; } Clien...
ClientStubBase { protected RuntimeException handleError(String url, HttpAdapterResponse response) throws IOException { RuntimeException e = handleError(client, response, client.getFormat()); if (e instanceof CrnkException) { CrnkException crnkException = (CrnkException) e; crnkException.setUrl(url); } return e; } Clien...
ClientStubBase { protected RuntimeException handleError(String url, HttpAdapterResponse response) throws IOException { RuntimeException e = handleError(client, response, client.getFormat()); if (e instanceof CrnkException) { CrnkException crnkException = (CrnkException) e; crnkException.setUrl(url); } return e; } Clien...
@Test(expected = ParserException.class) public void onInvalidBooleanThrowException() { sut.parse("NOT a boolean", Character.class); }
public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; }
TypeParser { public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; } }
TypeParser { public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; } TypeParser(); }
TypeParser { public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; } TypeParser(); boolean isEnforceJackson(); void setEnforceJackson(boolean enforceJackson); boolean...
TypeParser { public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; } TypeParser(); boolean isEnforceJackson(); void setEnforceJackson(boolean enforceJackson); boolean...
@Test public void onBooleanFReturnFalse() { Assert.assertFalse(sut.parse("f", Boolean.class)); }
public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; }
TypeParser { public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; } }
TypeParser { public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; } TypeParser(); }
TypeParser { public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; } TypeParser(); boolean isEnforceJackson(); void setEnforceJackson(boolean enforceJackson); boolean...
TypeParser { public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; } TypeParser(); boolean isEnforceJackson(); void setEnforceJackson(boolean enforceJackson); boolean...
@Test public void checkBooleanToString() { assertThat(sut.toString(Boolean.FALSE)).isEqualTo("false"); assertThat(sut.toString(Boolean.TRUE)).isEqualTo("true"); }
public String toString(Object input) { if (input == null) { return null; } Class<?> clazz = input.getClass(); if (String.class.equals(clazz)) { return (String) input; } StringMapper mapper = getMapper(clazz); if (mapper == null) { throw new ParserException(String.format("Cannot map to %s : %s", clazz.getName(), input))...
TypeParser { public String toString(Object input) { if (input == null) { return null; } Class<?> clazz = input.getClass(); if (String.class.equals(clazz)) { return (String) input; } StringMapper mapper = getMapper(clazz); if (mapper == null) { throw new ParserException(String.format("Cannot map to %s : %s", clazz.getNa...
TypeParser { public String toString(Object input) { if (input == null) { return null; } Class<?> clazz = input.getClass(); if (String.class.equals(clazz)) { return (String) input; } StringMapper mapper = getMapper(clazz); if (mapper == null) { throw new ParserException(String.format("Cannot map to %s : %s", clazz.getNa...
TypeParser { public String toString(Object input) { if (input == null) { return null; } Class<?> clazz = input.getClass(); if (String.class.equals(clazz)) { return (String) input; } StringMapper mapper = getMapper(clazz); if (mapper == null) { throw new ParserException(String.format("Cannot map to %s : %s", clazz.getNa...
TypeParser { public String toString(Object input) { if (input == null) { return null; } Class<?> clazz = input.getClass(); if (String.class.equals(clazz)) { return (String) input; } StringMapper mapper = getMapper(clazz); if (mapper == null) { throw new ParserException(String.format("Cannot map to %s : %s", clazz.getNa...
@Test public void checkNullToString() { assertThat(sut.toString(null)).isNull(); }
public String toString(Object input) { if (input == null) { return null; } Class<?> clazz = input.getClass(); if (String.class.equals(clazz)) { return (String) input; } StringMapper mapper = getMapper(clazz); if (mapper == null) { throw new ParserException(String.format("Cannot map to %s : %s", clazz.getName(), input))...
TypeParser { public String toString(Object input) { if (input == null) { return null; } Class<?> clazz = input.getClass(); if (String.class.equals(clazz)) { return (String) input; } StringMapper mapper = getMapper(clazz); if (mapper == null) { throw new ParserException(String.format("Cannot map to %s : %s", clazz.getNa...
TypeParser { public String toString(Object input) { if (input == null) { return null; } Class<?> clazz = input.getClass(); if (String.class.equals(clazz)) { return (String) input; } StringMapper mapper = getMapper(clazz); if (mapper == null) { throw new ParserException(String.format("Cannot map to %s : %s", clazz.getNa...
TypeParser { public String toString(Object input) { if (input == null) { return null; } Class<?> clazz = input.getClass(); if (String.class.equals(clazz)) { return (String) input; } StringMapper mapper = getMapper(clazz); if (mapper == null) { throw new ParserException(String.format("Cannot map to %s : %s", clazz.getNa...
TypeParser { public String toString(Object input) { if (input == null) { return null; } Class<?> clazz = input.getClass(); if (String.class.equals(clazz)) { return (String) input; } StringMapper mapper = getMapper(clazz); if (mapper == null) { throw new ParserException(String.format("Cannot map to %s : %s", clazz.getNa...
@Test public void onNullStringShouldReturnNullString() { String result = sut.parse((String) null, String.class); assertThat(result).isNull(); }
public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; }
TypeParser { public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; } }
TypeParser { public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; } TypeParser(); }
TypeParser { public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; } TypeParser(); boolean isEnforceJackson(); void setEnforceJackson(boolean enforceJackson); boolean...
TypeParser { public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; } TypeParser(); boolean isEnforceJackson(); void setEnforceJackson(boolean enforceJackson); boolean...
@Test public void onCharacterShouldReturnCharacter() { Character result = sut.parse("a", Character.class); assertThat(result).isExactlyInstanceOf(Character.class); assertThat(result).isEqualTo('a'); }
public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; }
TypeParser { public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; } }
TypeParser { public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; } TypeParser(); }
TypeParser { public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; } TypeParser(); boolean isEnforceJackson(); void setEnforceJackson(boolean enforceJackson); boolean...
TypeParser { public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; } TypeParser(); boolean isEnforceJackson(); void setEnforceJackson(boolean enforceJackson); boolean...
@Test public void onCharacterPrimitiveShouldReturnCharacter() { Character result = sut.parse("a", char.class); assertThat(result).isExactlyInstanceOf(Character.class); assertThat(result).isEqualTo('a'); }
public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; }
TypeParser { public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; } }
TypeParser { public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; } TypeParser(); }
TypeParser { public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; } TypeParser(); boolean isEnforceJackson(); void setEnforceJackson(boolean enforceJackson); boolean...
TypeParser { public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; } TypeParser(); boolean isEnforceJackson(); void setEnforceJackson(boolean enforceJackson); boolean...
@Test public void onLongCharacterShouldThrowException() { expectedException.expect(ParserException.class); sut.parse("ab", Character.class); }
public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; }
TypeParser { public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; } }
TypeParser { public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; } TypeParser(); }
TypeParser { public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; } TypeParser(); boolean isEnforceJackson(); void setEnforceJackson(boolean enforceJackson); boolean...
TypeParser { public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; } TypeParser(); boolean isEnforceJackson(); void setEnforceJackson(boolean enforceJackson); boolean...
@Test public void onUUIDStringShouldReturnUUID() { UUID result = sut.parse("de305d54-75b4-431b-adb2-eb6b9e546014", UUID.class); assertThat(result).isExactlyInstanceOf(UUID.class); assertThat(result).isEqualTo(UUID.fromString("de305d54-75b4-431b-adb2-eb6b9e546014")); }
public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; }
TypeParser { public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; } }
TypeParser { public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; } TypeParser(); }
TypeParser { public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; } TypeParser(); boolean isEnforceJackson(); void setEnforceJackson(boolean enforceJackson); boolean...
TypeParser { public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; } TypeParser(); boolean isEnforceJackson(); void setEnforceJackson(boolean enforceJackson); boolean...
@Test(expected = ParserException.class) public void onInvalidUUIDStringShouldThrowParserException() { sut.parse("invalid", UUID.class); }
public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; }
TypeParser { public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; } }
TypeParser { public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; } TypeParser(); }
TypeParser { public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; } TypeParser(); boolean isEnforceJackson(); void setEnforceJackson(boolean enforceJackson); boolean...
TypeParser { public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; } TypeParser(); boolean isEnforceJackson(); void setEnforceJackson(boolean enforceJackson); boolean...
@Test public void checkBodyWithErrors() throws IOException { Document document = new Document(); ErrorData errorData = new ErrorDataBuilder().setCode("404").setDetail("detail").build(); document.setErrors(Arrays.asList(errorData)); String body = client.getObjectMapper().writeValueAsString(document); HttpAdapterResponse...
protected RuntimeException handleError(String url, HttpAdapterResponse response) throws IOException { RuntimeException e = handleError(client, response, client.getFormat()); if (e instanceof CrnkException) { CrnkException crnkException = (CrnkException) e; crnkException.setUrl(url); } return e; }
ClientStubBase { protected RuntimeException handleError(String url, HttpAdapterResponse response) throws IOException { RuntimeException e = handleError(client, response, client.getFormat()); if (e instanceof CrnkException) { CrnkException crnkException = (CrnkException) e; crnkException.setUrl(url); } return e; } }
ClientStubBase { protected RuntimeException handleError(String url, HttpAdapterResponse response) throws IOException { RuntimeException e = handleError(client, response, client.getFormat()); if (e instanceof CrnkException) { CrnkException crnkException = (CrnkException) e; crnkException.setUrl(url); } return e; } Clien...
ClientStubBase { protected RuntimeException handleError(String url, HttpAdapterResponse response) throws IOException { RuntimeException e = handleError(client, response, client.getFormat()); if (e instanceof CrnkException) { CrnkException crnkException = (CrnkException) e; crnkException.setUrl(url); } return e; } Clien...
ClientStubBase { protected RuntimeException handleError(String url, HttpAdapterResponse response) throws IOException { RuntimeException e = handleError(client, response, client.getFormat()); if (e instanceof CrnkException) { CrnkException crnkException = (CrnkException) e; crnkException.setUrl(url); } return e; } Clien...
@Test public void onBooleanTrueShouldReturnBoolean() { Boolean result = sut.parse("true", Boolean.class); assertThat(result).isExactlyInstanceOf(Boolean.class); assertThat(result).isEqualTo(true); }
public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; }
TypeParser { public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; } }
TypeParser { public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; } TypeParser(); }
TypeParser { public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; } TypeParser(); boolean isEnforceJackson(); void setEnforceJackson(boolean enforceJackson); boolean...
TypeParser { public <T > Iterable<T> parse(Iterable<String> inputs, Class<T> clazz) { List<T> parsedValues = new LinkedList<>(); for (String input : inputs) { parsedValues.add(parse(input, clazz)); } return parsedValues; } TypeParser(); boolean isEnforceJackson(); void setEnforceJackson(boolean enforceJackson); boolean...