Search in sources :

Example 1 with PrimitiveDataParserImpl

use of edu.stanford.bmir.protege.web.client.primitive.PrimitiveDataParserImpl in project webprotege by protegeproject.

the class PrimitiveDataParserImpl_LiteralParsing_TestCase method setUp.

@Before
@SuppressWarnings("unchecked")
public void setUp() {
    primitiveTypes = Sets.newHashSet();
    primitiveTypes.add(PrimitiveType.LITERAL);
    doAnswer(new Answer<Void>() {

        @Override
        public Void answer(InvocationOnMock invocationOnMock) throws Throwable {
            AsyncCallback<Optional<OWLEntityData>> callback = (AsyncCallback<Optional<OWLEntityData>>) invocationOnMock.getArguments()[2];
            callback.onSuccess(Optional.empty());
            return null;
        }
    }).when(lookupHandler).lookupEntity(any(String.class), any(Set.class), any(AsyncCallback.class));
    parser = new PrimitiveDataParserImpl(lookupHandler);
}
Also used : Set(java.util.Set) Optional(java.util.Optional) PrimitiveDataParserImpl(edu.stanford.bmir.protege.web.client.primitive.PrimitiveDataParserImpl) InvocationOnMock(org.mockito.invocation.InvocationOnMock) AsyncCallback(com.google.gwt.user.client.rpc.AsyncCallback) OWLEntityData(edu.stanford.bmir.protege.web.shared.entity.OWLEntityData) Before(org.junit.Before)

Example 2 with PrimitiveDataParserImpl

use of edu.stanford.bmir.protege.web.client.primitive.PrimitiveDataParserImpl in project webprotege by protegeproject.

the class PrimitiveDataParserImpl_EntityParsing_TestCase method setUp.

@Before
@SuppressWarnings("unchecked")
public void setUp() {
    primitiveTypes = Sets.newHashSet();
    lookupMap = Maps.newHashMap();
    doAnswer(new Answer<Void>() {

        @Override
        public Void answer(InvocationOnMock invocationOnMock) throws Throwable {
            AsyncCallback<Optional<OWLEntityData>> callback = (AsyncCallback<Optional<OWLEntityData>>) invocationOnMock.getArguments()[2];
            callback.onSuccess(Optional.of(lookupMap.get(invocationOnMock.getArguments()[0])));
            return null;
        }
    }).when(lookupHandler).lookupEntity(any(String.class), any(Set.class), any(AsyncCallback.class));
    parser = new PrimitiveDataParserImpl(lookupHandler);
}
Also used : Set(java.util.Set) Optional(java.util.Optional) PrimitiveDataParserImpl(edu.stanford.bmir.protege.web.client.primitive.PrimitiveDataParserImpl) InvocationOnMock(org.mockito.invocation.InvocationOnMock) AsyncCallback(com.google.gwt.user.client.rpc.AsyncCallback) Before(org.junit.Before)

Aggregations

AsyncCallback (com.google.gwt.user.client.rpc.AsyncCallback)2 PrimitiveDataParserImpl (edu.stanford.bmir.protege.web.client.primitive.PrimitiveDataParserImpl)2 Optional (java.util.Optional)2 Set (java.util.Set)2 Before (org.junit.Before)2 InvocationOnMock (org.mockito.invocation.InvocationOnMock)2 OWLEntityData (edu.stanford.bmir.protege.web.shared.entity.OWLEntityData)1