mirror of https://github.com/dapr/java-sdk.git
Adding more unit test to reach 80% Coverage (#149)
This commit is contained in:
parent
614deb61bc
commit
57d0aff93a
|
@ -138,17 +138,12 @@
|
||||||
<configuration>
|
<configuration>
|
||||||
<rules>
|
<rules>
|
||||||
<rule>
|
<rule>
|
||||||
<element>CLASS</element>
|
<element>BUNDLE</element>
|
||||||
<limits>
|
<limits>
|
||||||
<limit>
|
<limit>
|
||||||
<counter>LINE</counter>
|
<counter>LINE</counter>
|
||||||
<value>COVEREDRATIO</value>
|
<value>COVEREDRATIO</value>
|
||||||
<minimum>0.00</minimum>
|
<minimum>80%</minimum>
|
||||||
</limit>
|
|
||||||
<limit>
|
|
||||||
<counter>BRANCH</counter>
|
|
||||||
<value>COVEREDRATIO</value>
|
|
||||||
<minimum>0.00</minimum>
|
|
||||||
</limit>
|
</limit>
|
||||||
</limits>
|
</limits>
|
||||||
</rule>
|
</rule>
|
||||||
|
|
|
@ -152,17 +152,12 @@
|
||||||
<configuration>
|
<configuration>
|
||||||
<rules>
|
<rules>
|
||||||
<rule>
|
<rule>
|
||||||
<element>CLASS</element>
|
<element>BUNDLE</element>
|
||||||
<limits>
|
<limits>
|
||||||
<limit>
|
<limit>
|
||||||
<counter>LINE</counter>
|
<counter>LINE</counter>
|
||||||
<value>COVEREDRATIO</value>
|
<value>COVEREDRATIO</value>
|
||||||
<minimum>0.00</minimum>
|
<minimum>80%</minimum>
|
||||||
</limit>
|
|
||||||
<limit>
|
|
||||||
<counter>BRANCH</counter>
|
|
||||||
<value>COVEREDRATIO</value>
|
|
||||||
<minimum>0.00</minimum>
|
|
||||||
</limit>
|
</limit>
|
||||||
</limits>
|
</limits>
|
||||||
<excludes>
|
<excludes>
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
package io.dapr.client;
|
||||||
|
|
||||||
|
import io.dapr.serializer.DaprObjectSerializer;
|
||||||
|
import org.junit.Test;
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
import static org.mockito.Mockito.mock;
|
||||||
|
|
||||||
|
public class DaprClientBuilderTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void build() {
|
||||||
|
DaprObjectSerializer objectSerializer = mock(DaprObjectSerializer.class);
|
||||||
|
DaprObjectSerializer stateSerializer = mock(DaprObjectSerializer.class);
|
||||||
|
DaprClientBuilder daprClientBuilder = new DaprClientBuilder(objectSerializer, stateSerializer);
|
||||||
|
DaprClient daprClient = daprClientBuilder.build();
|
||||||
|
assertNotNull(daprClient);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(expected = IllegalArgumentException.class)
|
||||||
|
public void buildException() {
|
||||||
|
DaprClientBuilder daprClientBuilder = new DaprClientBuilder(null,null);
|
||||||
|
DaprClient daprClient = daprClientBuilder.build();
|
||||||
|
assertNotNull(daprClient);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package io.dapr.client;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import java.time.Duration;
|
||||||
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
import static org.mockito.Mockito.mock;
|
||||||
|
|
||||||
|
public class DaprHttpBuilderTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void withReadTimeout() throws Exception {
|
||||||
|
DaprHttpBuilder daprHttpBuilder = new DaprHttpBuilder();
|
||||||
|
Duration duration = mock(Duration.class);
|
||||||
|
daprHttpBuilder.build();
|
||||||
|
DaprHttpBuilder dapr = daprHttpBuilder.withReadTimeout(duration);
|
||||||
|
assertNotNull(dapr);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue