public static Region createPartionedRegion(String regionname, PartitionAttributes prattribs)
      throws RegionExistsException {
    AttributesFactory attribFactory = new AttributesFactory();
    attribFactory.setDataPolicy(DataPolicy.PARTITION);
    attribFactory.setPartitionAttributes(prattribs);
    RegionAttributes regionAttribs = attribFactory.create();

    Region partitionedregion = createCache().createRegion(regionname, regionAttribs);
    return partitionedregion;
  }
This method creates a partitioned region with the given PR attributes. The cache created is a
loner, so this is only suitable for single VM tests.
geode-junit/src/main/java/org/apache/geode/internal/cache/PartitionedRegionTestHelper.java