Skip to content

Commit

Permalink
[#855] Fixes for codacy
Browse files Browse the repository at this point in the history
  • Loading branch information
valeria committed Sep 6, 2017
1 parent f4cb1f3 commit 272d97f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions app/src/main/java/org/akvo/flow/data/loader/models/FormInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ public class FormInfo {
private final Long lastSubmission;
private final boolean deleted;
private final boolean isRegistrationSurvey;

public boolean isSubmittedDataPoint() {
return submittedDataPoint;
}

private final boolean submittedDataPoint;

public FormInfo(String id, String name, String version, Long lastSubmission,
Expand Down Expand Up @@ -70,7 +65,12 @@ public boolean isRegistrationForm() {
return isRegistrationSurvey;
}

public boolean isSubmittedDataPoint() {
return submittedDataPoint;
}

public boolean hasBeenSubmitted() {
return lastSubmission != null && lastSubmission != 0L;
}

}
14 changes: 7 additions & 7 deletions app/src/test/java/org/akvo/flow/ui/model/ViewFormMapperTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class ViewFormMapperTest {
private FormInfo mockSurveyItem;

@Before
public void setup() {
public void setUp() {
PowerMockito.mockStatic(TextUtils.class);
PowerMockito.when(TextUtils.isEmpty(any(CharSequence.class))).thenAnswer(new Answer<Boolean>() {
@Override
Expand All @@ -70,7 +70,7 @@ public Boolean answer(InvocationOnMock invocation) throws Throwable {
}

@Test
public void transform_ShouldReturnEmptyArrayIfNull() {
public void transformShouldReturnEmptyArrayIfNull() {
ViewFormMapper mapper = new ViewFormMapper();
List<FormInfo> original = null;

Expand All @@ -81,7 +81,7 @@ public void transform_ShouldReturnEmptyArrayIfNull() {
}

@Test
public void transform_ShouldIgnoreNullItems() {
public void transformShouldIgnoreNullItems() {
ViewFormMapper mapper = new ViewFormMapper();
List<FormInfo> original = new ArrayList<>();
original.add(null);
Expand All @@ -94,7 +94,7 @@ public void transform_ShouldIgnoreNullItems() {
}

@Test
public void transform_ShouldTransformCorrectlyDeletedSurvey() {
public void transformShouldTransformCorrectlyDeletedSurvey() {
ViewFormMapper mapper = new ViewFormMapper();

given(mockSurveyItem.isDeleted()).willReturn(true);
Expand All @@ -107,7 +107,7 @@ public void transform_ShouldTransformCorrectlyDeletedSurvey() {
}

@Test
public void transform_ShouldTransformCorrectlyNonSubmittedSurvey() {
public void transformShouldTransformCorrectlyNonSubmittedSurvey() {
ViewFormMapper mapper = new ViewFormMapper();

given(mockSurveyItem.isDeleted()).willReturn(false);
Expand All @@ -120,7 +120,7 @@ public void transform_ShouldTransformCorrectlyNonSubmittedSurvey() {
}

@Test
public void transform_ShouldTransformCorrectlyNonRegistrationMonitoredSurvey() {
public void transformShouldTransformCorrectlyNonRegistrationMonitoredSurvey() {
ViewFormMapper mapper = new ViewFormMapper();

given(mockSurveyItem.isDeleted()).willReturn(false);
Expand All @@ -136,7 +136,7 @@ public void transform_ShouldTransformCorrectlyNonRegistrationMonitoredSurvey() {
}

@Test
public void transform_ShouldTransformCorrectlyAllSurveyFields() {
public void transformShouldTransformCorrectlyAllSurveyFields() {
ViewFormMapper mapper = new ViewFormMapper();

given(mockSurveyItem.isDeleted()).willReturn(false);
Expand Down

0 comments on commit 272d97f

Please sign in to comment.