use of com.microsoft.graph.logger.DefaultLogger in project msgraph-sdk-java by microsoftgraph.
the class DefaultClientConfigTests method testOverrideLoggerShouldNotThrow.
@Test
public void testOverrideLoggerShouldNotThrow() {
final ILogger logger = new DefaultLogger();
DefaultClientConfig config = new DefaultClientConfig() {
@Override
public ILogger getLogger() {
return logger;
}
@Override
public IAuthenticationProvider getAuthenticationProvider() {
return new MockAuthenticationProvider();
}
};
config.getExecutors();
config.getAuthenticationProvider();
config.getHttpProvider();
config.getSerializer();
config.getLogger();
}
use of com.microsoft.graph.logger.DefaultLogger in project msgraph-sdk-java by microsoftgraph.
the class GraphServiceExceptionTests method testCreateFromConnection.
@Test
public void testCreateFromConnection() {
DefaultLogger logger = new DefaultLogger();
GraphServiceException exception = null;
Boolean success = false;
Boolean failure = false;
final ITestConnectionData data = new ITestConnectionData() {
@Override
public int getRequestCode() {
return 401;
}
@Override
public String getJsonResponse() {
return "{}";
}
@Override
public Map<String, String> getHeaders() {
return new HashMap<>();
}
};
try {
exception = GraphServiceException.createFromConnection(new MockHttpRequest(), null, null, new MockConnection(data) {
}, logger);
success = true;
} catch (IOException ex) {
failure = true;
}
assertTrue(success);
assertFalse(failure);
String message = exception.getMessage();
assertTrue(message.indexOf("Error code: Unable to parse error response message") == 0);
assertTrue(message.indexOf("http://localhost") > 0);
}
use of com.microsoft.graph.logger.DefaultLogger in project msgraph-sdk-java by microsoftgraph.
the class DefaultSeralizerTests method testRecurrenceRangeDeserialization.
@Test
public void testRecurrenceRangeDeserialization() throws Exception {
final DefaultSerializer serializer = new DefaultSerializer(new DefaultLogger());
String source = "{\n" + " \"type\": \"noEnd\",\n" + " \"startDate\": \"2016-04-27\",\n" + " \"endDate\": \"0001-01-01\",\n" + " \"recurrenceTimeZone\": \"China Standard Time\",\n" + " \"numberOfOccurrences\": 0\n" + "}";
BaseRecurrenceRange baseRecurrenceRange = serializer.deserializeObject(source, BaseRecurrenceRange.class);
assertNotNull(source);
assertEquals(RecurrenceRangeType.NO_END, baseRecurrenceRange.type);
assertEquals("2016-04-27", baseRecurrenceRange.startDate.toString());
assertEquals("0001-01-01", baseRecurrenceRange.endDate.toString());
assertEquals("China Standard Time", baseRecurrenceRange.recurrenceTimeZone);
assertEquals(Integer.valueOf(0), baseRecurrenceRange.numberOfOccurrences);
}
Aggregations