Search in sources :

Example 1 with GsonConfigSource

use of io.github.wysohn.triggerreactor.core.config.source.GsonConfigSource in project TriggerReactor by wysohn.

the class TestGsonConfigSource method init.

@Before
public void init() {
    mockMain = Mockito.mock(TriggerReactorCore.class);
    mockFile = Mockito.mock(File.class);
    stringWriter = new StringWriter();
    manager = new GsonConfigSource(mockFile, (f) -> new StringReader(jsonString), (f) -> stringWriter);
    Mockito.when(mockFile.exists()).thenReturn(true);
    Mockito.when(mockFile.length()).thenReturn(Long.MAX_VALUE);
}
Also used : TypeToken(io.github.wysohn.gsoncopy.reflect.TypeToken) java.util(java.util) StringWriter(java.io.StringWriter) Test(org.junit.Test) GsonConfigSource(io.github.wysohn.triggerreactor.core.config.source.GsonConfigSource) Field(java.lang.reflect.Field) TriggerReactorCore(io.github.wysohn.triggerreactor.core.main.TriggerReactorCore) File(java.io.File) Mockito(org.mockito.Mockito) GsonBuilder(io.github.wysohn.gsoncopy.GsonBuilder) StringReader(java.io.StringReader) LinkedTreeMap(io.github.wysohn.gsoncopy.internal.LinkedTreeMap) Gson(io.github.wysohn.gsoncopy.Gson) Serializer(io.github.wysohn.triggerreactor.core.config.serialize.Serializer) Assert.assertEquals(org.junit.Assert.assertEquals) Before(org.junit.Before) TriggerReactorCore(io.github.wysohn.triggerreactor.core.main.TriggerReactorCore) GsonConfigSource(io.github.wysohn.triggerreactor.core.config.source.GsonConfigSource) StringWriter(java.io.StringWriter) StringReader(java.io.StringReader) File(java.io.File) Before(org.junit.Before)

Aggregations

Gson (io.github.wysohn.gsoncopy.Gson)1 GsonBuilder (io.github.wysohn.gsoncopy.GsonBuilder)1 LinkedTreeMap (io.github.wysohn.gsoncopy.internal.LinkedTreeMap)1 TypeToken (io.github.wysohn.gsoncopy.reflect.TypeToken)1 Serializer (io.github.wysohn.triggerreactor.core.config.serialize.Serializer)1 GsonConfigSource (io.github.wysohn.triggerreactor.core.config.source.GsonConfigSource)1 TriggerReactorCore (io.github.wysohn.triggerreactor.core.main.TriggerReactorCore)1 File (java.io.File)1 StringReader (java.io.StringReader)1 StringWriter (java.io.StringWriter)1 Field (java.lang.reflect.Field)1 java.util (java.util)1 Assert.assertEquals (org.junit.Assert.assertEquals)1 Before (org.junit.Before)1 Test (org.junit.Test)1 Mockito (org.mockito.Mockito)1