### Question:
JPAAnnotationBuilder extends BaseBuilder<Class<? extends Annotation>> { public void add(Class<? extends Annotation> annotation, Map<String, String> attrs) { add(annotation); if (attrs != null && !attrs.isEmpty()) { builderString.append('('); for (Map.Entry<String, String> attr : attrs.entrySet()) { builderString.append(attr.getKey()).append('=').append(attr.getValue()).append(','); } builderString.deleteCharAt(builderString.lastIndexOf(",")); builderString.append(')'); } } JPAAnnotationBuilder(int numIndents); void add(Class<? extends Annotation> annotation, Map<String, String> attrs);  }### Answer:
@Test public void testBasicAnnotation() { JPAAnnotationBuilder builder = new JPAAnnotationBuilder(0); builder.add(Id.class); assertEquals(builder.toString(), "@Id", "Unexpected annotations built by JPAAnnotationBuilder."); }
@Test public void testCustomAnnotation() { JPAAnnotationBuilder builder = new JPAAnnotationBuilder(0); builder.add(CustomObject.class); assertEquals(builder.toString(), "@com.force.sdk.jpa.annotation.CustomObject", "Unexpected annotations built by JPAAnnotationBuilder."); }
@Test public void testAnnotationWithAttributes() { JPAAnnotationBuilder builder = new JPAAnnotationBuilder(0); builder.add(Id.class, Collections.<String, String>singletonMap("name", "\"foobar\"")); assertEquals(builder.toString(), "@Id(name=\"foobar\")", "Unexpected annotations built by JPAAnnotationBuilder."); }
@Test public void testMultipleAnnotations() { JPAAnnotationBuilder builder = new JPAAnnotationBuilder(0); builder.add(Id.class); builder.add(GeneratedValue.class); assertEquals(builder.toString(), "@Id\n@GeneratedValue", "Unexpected annotations built by JPAAnnotationBuilder."); }
@Test public void testIndenting() { JPAAnnotationBuilder builder = new JPAAnnotationBuilder(1); builder.add(Id.class); assertEquals(builder.toString(), " @Id", "Unexpected annotations built by JPAAnnotationBuilder."); }