use of org.apereo.portal.soffit.model.v1_0.Preferences in project uPortal by Jasig.
the class ModelAttributeServiceTest method testGetModelAttributeFromMethod.
@Test
public void testGetModelAttributeFromMethod() {
final ModelAttributeService modelAttributeService = new ModelAttributeService();
final Class[] parameterClasses = new Class[] { HttpServletRequest.class, PortalRequest.class, Bearer.class };
final Method method;
try {
method = getClass().getMethod("soffitModelAttributeMethod", parameterClasses);
} catch (NoSuchMethodException e) {
throw new RuntimeException(e);
}
// Object Model
final HttpServletRequest req = Mockito.mock(HttpServletRequest.class);
final HttpServletResponse res = Mockito.mock(HttpServletResponse.class);
final PortalRequest portalRequest = Mockito.mock(PortalRequest.class);
final Bearer bearer = Mockito.mock(Bearer.class);
final Preferences preferences = Mockito.mock(Preferences.class);
final Definition definition = Mockito.mock(Definition.class);
final Object modelAttribute = modelAttributeService.getModelAttributeFromMethod(this, method, req, res, portalRequest, bearer, preferences, definition);
assertEquals("Incorrect modelAttribute", modelAttribute, returnValue);
final Method brokenMethod;
try {
brokenMethod = getClass().getMethod("brokenSoffitModelAttributeMethod", parameterClasses);
} catch (NoSuchMethodException e) {
throw new RuntimeException(e);
}
try {
modelAttributeService.getModelAttributeFromMethod(this, brokenMethod, req, res, portalRequest, bearer, preferences, definition);
fail("Expected IllegalStateException for void-declaring method");
} catch (IllegalStateException e) {
// Expected; fall through...
}
}
use of org.apereo.portal.soffit.model.v1_0.Preferences in project ORCID-Source by ORCID.
the class ValidateV2RC3SamplesTest method testUnmarshallPreferences.
@Test
public void testUnmarshallPreferences() throws SAXException, URISyntaxException {
Preferences preferences = (Preferences) unmarshallFromPath("/record_2.0_rc3/samples/preferences-2.0_rc3.xml", Preferences.class, "/record_2.0_rc3/preferences-2.0_rc3.xsd");
assertNotNull(preferences);
assertNotNull(preferences.getLocale());
assertEquals(Locale.EN, preferences.getLocale());
}
use of org.apereo.portal.soffit.model.v1_0.Preferences in project ORCID-Source by ORCID.
the class ValidateV2RC3SamplesTest method testMarshallPreferences.
@Test
public void testMarshallPreferences() throws JAXBException, SAXException, URISyntaxException {
Preferences object = (Preferences) unmarshallFromPath("/record_2.0_rc3/samples/preferences-2.0_rc3.xml", Preferences.class);
marshall(object, "/record_2.0_rc3/preferences-2.0_rc3.xsd");
}
use of org.apereo.portal.soffit.model.v1_0.Preferences in project ORCID-Source by ORCID.
the class ValidateV2RC2SamplesTest method testMarshallPreferences.
@Test
public void testMarshallPreferences() throws JAXBException, SAXException, URISyntaxException {
Preferences object = (Preferences) unmarshallFromPath("/record_2.0_rc2/samples/preferences-2.0_rc2.xml", Preferences.class);
marshall(object, "/record_2.0_rc2/preferences-2.0_rc2.xsd");
}
use of org.apereo.portal.soffit.model.v1_0.Preferences in project ORCID-Source by ORCID.
the class ValidateV2RC2SamplesTest method testUnmarshallPreferences.
@Test
public void testUnmarshallPreferences() throws SAXException, URISyntaxException {
Preferences preferences = (Preferences) unmarshallFromPath("/record_2.0_rc2/samples/preferences-2.0_rc2.xml", Preferences.class, "/record_2.0_rc2/preferences-2.0_rc2.xsd");
assertNotNull(preferences);
assertNotNull(preferences.getLocale());
assertEquals(Locale.EN, preferences.getLocale());
}
Aggregations