WorkAreaConfig { public WorkArea createWorkArea() { if(Registry.containsWorkArea(this.id)) { return Registry.getWorkArea(this.id); } SortedSet<Field> uniqueSet = new TreeSet<Field>(); validate(this.fields, uniqueSet); List<Filter> oFilters = this.outputFilters != null ? this.outputFilters : Collections.<Filter>emptyList(); WorkArea workArea = new WorkArea(this.id, uniqueSet, oFilters); validate(workArea); Registry.addWorkArea(workArea); return workArea; } WorkAreaConfig();  WorkAreaConfig(String id, int length, boolean isWorkAreaOne, List<Field> fields, List<Filter> outputFilters); WorkArea createWorkArea(); String getId(); int getLength(); void setLength(int length); boolean isWorkAreaOne(); void setWorkAreaOne(boolean isWorkAreaOne); List<Field> getFields(); void setFields(List<Field> fields); List<Filter> getOutputFilters(); void setOutputFilters(List<Filter> outputFilters); @Override String toString();  }
@Test public void testCreateWorkArea() { Registry.clearWorkAreas(); WorkArea workArea = this.workAreaConfig.createWorkArea(); assertTrue(Registry.containsWorkArea(workArea.getId())); assertTrue(this.length == workArea.length()); assertTrue(workArea.isFiltered(TestData.fieldOne)); }
@Test public void testCreateWorkArea_invalidLength() { Registry.clearWorkAreas(); assertThrows(InvalidWorkAreaLengthException.class, () -> { new WorkAreaConfig(this.id, 13, this.isWorkAreaOne, this.fields, this.outputFilters).createWorkArea(); }); }