### Question:
EntityUtil { public static <T extends BaseEntity> void updatePKFieldValue(T entity, String value) { Field field = getPKField(entity); if (field != null) { if (isSubClass("BasePK", field.getType()) == false) { try { field.setAccessible(true); field.set(entity, value); } catch (IllegalArgumentException | IllegalAccessException ex) { throw new OpenStorefrontRuntimeException("Unable to set value on " + entity.getClass().getName(), "Check entity passed in."); } } else { throw new OpenStorefrontRuntimeException("Set value on Composite PK is not supported. Entity: " + entity.getClass().getName(), "Check entity passed in."); } } else { throw new OpenStorefrontRuntimeException("Unable to find PK for enity: " + entity.getClass().getName(), "Check entity passed in."); } }  static void setDefaultsOnFields(Object entity); static boolean isObjectsDifferent(Object original, Object compare, boolean consumeFieldsOnly); @SuppressWarnings("unchecked") static int compareConsumeFields(Object original, Object compare); static Field getPKField(T entity); static boolean isPKFieldGenerated(T entity); static String getPKFieldValue(T entity); static Object getPKFieldObjectValue(T entity); static void updatePKFieldValue(T entity, String value); static Map<String, Object> findIdField(Class entityClass, Object id); static String getRealClassName(String className);  }### Answer:
@Test public void testUpdatePKFieldValue() { System.out.println("updatePKFieldValue"); Component entity = new Component(); String value = "Test"; EntityUtil.updatePKFieldValue(entity, value); assertEquals("Test", entity.getComponentId()); AttributeType aType = new AttributeType(); aType.setAttributeType("Attribute PK old"); EntityUtil.updatePKFieldValue(aType, "Attribute PK new"); String expResult = "Attribute PK new"; String result = EntityUtil.getPKFieldValue(aType); System.out.println(result); assertEquals(expResult, result); AttributeCode aCode = new AttributeCode(); AttributeCodePk aCodePk = new AttributeCodePk(); aCodePk.setAttributeCode("Attribute Code PK old"); aCodePk.setAttributeType("Attribute Type PK old"); aCode.setAttributeCodePk(aCodePk); try { EntityUtil.updatePKFieldValue(aCode, "Attribute Code PK new"); result = EntityUtil.getPKFieldValue(aCode); System.out.println(result); } catch (OpenStorefrontRuntimeException e) { System.out.println("Test Passed"); } }