blob: 34cdf4fdbf0d39f97a3d34156002bde508085bf4 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2007, 2013 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0, which accompanies this distribution
* and is available at https://www.eclipse.org/legal/epl-2.0/.
*
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
package org.eclipse.jpt.jpa.core.tests.internal.resource.java;
import java.util.Iterator;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
import org.eclipse.jpt.common.utility.internal.iterable.IterableTools;
import org.eclipse.jpt.common.utility.internal.iterator.IteratorTools;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
import org.eclipse.jpt.jpa.core.resource.java.LobAnnotation;
@SuppressWarnings("nls")
public class LobTests extends JpaJavaResourceModelTestCase {
public LobTests(String name) {
super(name);
}
private ICompilationUnit createTestLob() throws Exception {
return this.createTestType(new DefaultAnnotationWriter() {
@Override
public Iterator<String> imports() {
return IteratorTools.iterator(JPA.LOB);
}
@Override
public void appendIdFieldAnnotationTo(StringBuilder sb) {
sb.append("@Lob");
}
});
}
public void testLob() throws Exception {
ICompilationUnit cu = this.createTestLob();
JavaResourceType resourceType = buildJavaResourceType(cu);
JavaResourceField resourceField = IterableTools.get(resourceType.getFields(), 0);
LobAnnotation lob = (LobAnnotation) resourceField.getAnnotation(JPA.LOB);
assertNotNull(lob);
}
}