Search in sources :

Example 1 with MockAppender

use of com.hedera.test.mocks.MockAppender in project hedera-services by hashgraph.

the class BasicFcfsUsagePricesTest method returnsDefaultUsagePricesForUnsupported.

@Test
void returnsDefaultUsagePricesForUnsupported() {
    // setup:
    MockAppender mockAppender = new MockAppender();
    var log = (org.apache.logging.log4j.core.Logger) LogManager.getLogger(BasicFcfsUsagePrices.class);
    log.addAppender(mockAppender);
    Level levelForReset = log.getLevel();
    log.setLevel(Level.DEBUG);
    // given:
    subject.loadPriceSchedules();
    Timestamp at = Timestamp.newBuilder().setSeconds(currentExpiry - 1).build();
    // when:
    Map<SubType, FeeData> actual = subject.pricesGiven(UNRECOGNIZED, at);
    // then:
    assertEquals(DEFAULT_RESOURCE_PRICES, actual);
    assertEquals(1, mockAppender.size());
    assertEquals("DEBUG - Default usage price will be used, no specific usage prices available for function " + "UNRECOGNIZED" + " @ 1970-01-15T06:56:06Z!", mockAppender.get(0));
    // tearDown:
    log.setLevel(levelForReset);
    log.removeAppender(mockAppender);
    mockAppender.clear();
}
Also used : MockAppender(com.hedera.test.mocks.MockAppender) SubType(com.hederahashgraph.api.proto.java.SubType) Level(org.apache.logging.log4j.Level) Timestamp(com.hederahashgraph.api.proto.java.Timestamp) FeeData(com.hederahashgraph.api.proto.java.FeeData) Test(org.junit.jupiter.api.Test)

Aggregations

MockAppender (com.hedera.test.mocks.MockAppender)1 FeeData (com.hederahashgraph.api.proto.java.FeeData)1 SubType (com.hederahashgraph.api.proto.java.SubType)1 Timestamp (com.hederahashgraph.api.proto.java.Timestamp)1 Level (org.apache.logging.log4j.Level)1 Test (org.junit.jupiter.api.Test)1