### Question:
CcCourtAreaFieldValueCreator { public String createCcCourtAreaFieldValue(Long parentAreaCourtId, CommonCourt ccCourt) { Preconditions.checkNotNull(ccCourt); String ccCourtArea = ccCourt.getName() + CC_COURT_AREA_VALUE_PART_SEPARATOR + ccCourt.getId(); String parentAreaCourtIdStr = calcParentAreaCourtId(parentAreaCourtId); ccCourtArea = fieldValuePrefixAdder.addFieldPrefix(parentAreaCourtIdStr, ccCourtArea); return ccCourtArea; }  String createCcCourtAreaFieldValue(Long parentAreaCourtId, CommonCourt ccCourt); static final String CC_COURT_AREA_VALUE_PART_SEPARATOR; static final String NULL_PARENT_COURT_ID; }### Answer:
@Test(expected=NullPointerException.class) public void createCcCourtAreaFieldValue_NULL_Court() { ccCourtAreaFieldValueCreator.createCcCourtAreaFieldValue(12L, null); }
@Test public void createCcCourtAreaFieldValue() { CommonCourt court = new CommonCourt(); Whitebox.setInternalState(court, "id", 12L); court.setName("Sąd Okręgowy w Lublinie"); String sep = CcCourtAreaFieldValueCreator.CC_COURT_AREA_VALUE_PART_SEPARATOR; when(fieldValuePrefixAdder.addFieldPrefix("17", "Sąd Okręgowy w Lublinie"+sep+"12")).thenReturn("17_Sąd Okręgowy w Lublinie"+sep+"12"); String ccCourtArea = ccCourtAreaFieldValueCreator.createCcCourtAreaFieldValue(17L, court); assertEquals("17_Sąd Okręgowy w Lublinie"+sep+"12", ccCourtArea); }
@Test public void createCcCourtAreaFieldValue_parentAreaCourtId_NULL() { CommonCourt court = new CommonCourt(); Whitebox.setInternalState(court, "id", 12L); court.setName("Sąd Okręgowy w Lublinie"); String sep = CcCourtAreaFieldValueCreator.CC_COURT_AREA_VALUE_PART_SEPARATOR; String na = CcCourtAreaFieldValueCreator.NULL_PARENT_COURT_ID; when(fieldValuePrefixAdder.addFieldPrefix(na, "Sąd Okręgowy w Lublinie"+sep+"12")).thenReturn(na+"_Sąd Okręgowy w Lublinie"+sep+"12"); String ccCourtArea = ccCourtAreaFieldValueCreator.createCcCourtAreaFieldValue(null, court); assertEquals(na+"_Sąd Okręgowy w Lublinie"+sep+"12", ccCourtArea); }