Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
MikhailSuendukov committed Aug 17, 2023
1 parent 5aaca35 commit 689134d
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,17 @@ public void writeNullDeviceTest() throws JSONException {
@Test
public void readNotNullDataResidencyRegionTest() throws JSONException {
JSONObject mockJsonObject = mock(JSONObject.class);
String dataResidencyRegion = "RG";

when(mockJsonObject.has(DATA_RESIDENCY_REGION)).thenReturn(true);
when(mockJsonObject.optString(DATA_RESIDENCY_REGION)).thenReturn("RG");
when(mockJsonObject.optString(DATA_RESIDENCY_REGION, null)).thenReturn(dataResidencyRegion);
when(mockJsonObject.getString(CommonProperties.TYPE)).thenReturn("mockType");
when(mockJsonObject.getString(TIMESTAMP)).thenReturn(JSONDateUtils.toString(new Date()));

AbstractLog mockLog = new MockLogWithType();
mockLog.read(mockJsonObject);

verify(mockJsonObject).optString(eq(DATA_RESIDENCY_REGION), isNull());
assertEquals(dataResidencyRegion, mockLog.getDataResidencyRegion());
}

@Test
Expand Down

0 comments on commit 689134d

Please sign in to comment.