nheyek/SDP-2018

View on GitHub
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java

Summary

Maintainability
C
1 day
Test Coverage

EditQuestionActivityTest has 23 methods (exceeds 20 allowed). Consider refactoring.
Open

@SuppressWarnings("HardCodedStringLiteral")
@RunWith(AndroidJUnit4.class)
public class EditQuestionActivityTest {
    private final String questionUUID = "Temporary fake uuid";
    private Question q;

    Method editTrueFalseQuestionAnswerImagedToTextBasedTest has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        @Test
        public void editTrueFalseQuestionAnswerImagedToTextBasedTest() throws Throwable {
            q = new Question(questionUUID, this.getClass().getName(), true, 0, Constants.Course.SWENG.name(), "en");
            mActivityRule.launchActivity(new Intent().putExtra(AddOrEditQuestionActivity.class.getSimpleName(), q));
    
    

      Method editAndCheckQuestionHelper has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private void editAndCheckQuestionHelper(final int newAnswerNumber, final boolean changeType, final boolean isTrueFalseBeforeEdition) throws Throwable {
              mActivityRule.runOnUiThread(new Runnable() {
                  @Override
                  public void run() {
                      mActivityRule.getActivity().findViewById(R.id.addOrEditQuestionButton).callOnClick();

        Similar blocks of code found in 8 locations. Consider refactoring.
        Open

            @Test
            public void editMCQToTrueFalseQuestionAnswer4to0Test() throws Throwable {
                q = new Question(questionUUID, this.getClass().getName(), false, 3, Constants.Course.SWENG.name(), "en");
                editAndCheckQuestion(R.id.radio_answer1, 0, true);
            }
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 145..149
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 153..157
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 160..164
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 166..170
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 172..176
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 178..182
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 184..188

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 47.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 8 locations. Consider refactoring.
        Open

            @Test
            public void editTrueFalseQuestionAnswer1to0Test() throws Throwable {
                q = new Question(questionUUID, this.getClass().getName(), true, 1, Constants.Course.SWENG.name(), "en");
                editAndCheckQuestion(R.id.radio_answer1, 0, false);
            }
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 145..149
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 160..164
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 166..170
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 172..176
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 178..182
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 184..188
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 190..194

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 47.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 8 locations. Consider refactoring.
        Open

            @Test
            public void editMCQQuestionAnswer4to1Test() throws Throwable {
                q = new Question(questionUUID, this.getClass().getName(), false, 3, Constants.Course.SWENG.name(), "en");
                editAndCheckQuestion(R.id.radio_answer1, 0, false);
            }
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 145..149
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 153..157
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 160..164
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 166..170
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 172..176
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 178..182
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 190..194

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 47.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 8 locations. Consider refactoring.
        Open

            @Test
            public void editMCQQuestionAnswer0to1Test() throws Throwable {
                q = new Question(questionUUID, this.getClass().getName(), false, 0, Constants.Course.SWENG.name(), "en");
                editAndCheckQuestion(R.id.radio_answer2, 1, false);
            }
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 145..149
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 153..157
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 160..164
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 172..176
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 178..182
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 184..188
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 190..194

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 47.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 8 locations. Consider refactoring.
        Open

            @Test
            public void editMCQQuestionAnswer1to2Test() throws Throwable {
                q = new Question(questionUUID, this.getClass().getName(), false, 0, Constants.Course.SWENG.name(), "en");
                editAndCheckQuestion(R.id.radio_answer2, 1, false);
            }
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 145..149
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 153..157
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 160..164
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 166..170
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 178..182
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 184..188
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 190..194

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 47.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 8 locations. Consider refactoring.
        Open

            @Test
            public void editTrueFalseQuestionAnswer0to1Test()  throws Throwable {
                q = new Question(questionUUID, this.getClass().getName(), true, 0, Constants.Course.SWENG.name(), "en");
                editAndCheckQuestion(R.id.radio_answer2, 1, false);
            }
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 153..157
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 160..164
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 166..170
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 172..176
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 178..182
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 184..188
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 190..194

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 47.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 8 locations. Consider refactoring.
        Open

            @Test
            public void editMCQQuestionAnswer3to2Test() throws Throwable {
                q = new Question(questionUUID, this.getClass().getName(), false, 2, Constants.Course.SWENG.name(), "en");
                editAndCheckQuestion(R.id.radio_answer2, 1, false);
            }
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 145..149
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 153..157
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 160..164
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 166..170
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 172..176
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 184..188
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 190..194

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 47.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 8 locations. Consider refactoring.
        Open

            @Test
            public void editTrueFalseToMCQAnswer0To3Test() throws Throwable {
                q = new Question(questionUUID, this.getClass().getName(), true, 0, Constants.Course.SWENG.name(), "en");
                editAndCheckQuestion(R.id.radio_answer3, 2, true);
            }
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 145..149
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 153..157
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 166..170
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 172..176
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 178..182
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 184..188
        app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 190..194

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 47.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        There are no issues that match your filters.

        Category
        Status