@Test(expected=NullPointerException.class) public void testBuildIdNoId() { Map<String, Object> map = new HashMap<>(); map.put("attribute", "artist"); builder.buildId(map); }
@Override public DocumentId buildId(Map<String,Object> obj) { Object obj1 = obj.get(this.key1); Object obj2 = obj.get(this.key2); Validate.notNull(obj1, "every object must have "+this.key1+": "+obj); Validate.notNull(obj2, "every object must have "+this.key2+": "+obj); return new DocumentIdPair(key1, key2, obj1, obj2); }
DocumentIdBuilderPair implements DocumentIdBuilder { @Override public DocumentId buildId(Map<String,Object> obj) { Object obj1 = obj.get(this.key1); Object obj2 = obj.get(this.key2); Validate.notNull(obj1, "every object must have "+this.key1+": "+obj); Validate.notNull(obj2, "every object must have "+this.key2+": "+obj); return new DocumentIdPair(key1, key2, obj1, obj2); } }
DocumentIdBuilderPair implements DocumentIdBuilder { @Override public DocumentId buildId(Map<String,Object> obj) { Object obj1 = obj.get(this.key1); Object obj2 = obj.get(this.key2); Validate.notNull(obj1, "every object must have "+this.key1+": "+obj); Validate.notNull(obj2, "every object must have "+this.key2+": "+obj); return new DocumentIdPair(key1, key2, obj1, obj2); }  }
DocumentIdBuilderPair implements DocumentIdBuilder { @Override public DocumentId buildId(Map<String,Object> obj) { Object obj1 = obj.get(this.key1); Object obj2 = obj.get(this.key2); Validate.notNull(obj1, "every object must have "+this.key1+": "+obj); Validate.notNull(obj2, "every object must have "+this.key2+": "+obj); return new DocumentIdPair(key1, key2, obj1, obj2); }  @Override DocumentId buildId(Map<String,Object> obj); @Override void init(Map<String, String> configuration); }
DocumentIdBuilderPair implements DocumentIdBuilder { @Override public DocumentId buildId(Map<String,Object> obj) { Object obj1 = obj.get(this.key1); Object obj2 = obj.get(this.key2); Validate.notNull(obj1, "every object must have "+this.key1+": "+obj); Validate.notNull(obj2, "every object must have "+this.key2+": "+obj); return new DocumentIdPair(key1, key2, obj1, obj2); }  @Override DocumentId buildId(Map<String,Object> obj); @Override void init(Map<String, String> configuration);  }