Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle unnamed packages #5

Open
DhruvDh opened this issue Oct 26, 2021 · 0 comments
Open

handle unnamed packages #5

DhruvDh opened this issue Oct 26, 2021 · 0 comments

Comments

@DhruvDh
Copy link
Owner

DhruvDh commented Oct 26, 2021

import org.junit.Before;
import org.junit.After;
import org.junit.Test;
import static org.junit.Assert.*;

public class Exam2Test {
    @Before
    public void setUp() {
        // Setup code here (if required)
    }

    @After
    public void tearDown() {
        // Teardown code here (if required)
    }

    @Test
    public void testQuestion1() {
        var solution = (score1, score2, score3) -> {
            float total = score1 + score2 + score3;
            float avg = total / 3.0;

            if (avg >= 90) {
                return 'A';
            } else if (avg >= 80) {
                return 'B';
            } else if (avg >= 70) {
                return 'C';
            } else if (avg >= 60) {
                return 'D';
            } else {
                return 'F';
            }
        };

        for (int i = 0; i < 10; i++) {
            var score1 = (int) (Math.random() * 100);
            var score2 = (int) (Math.random() * 100);
            var score3 = (int) (Math.random() * 100);

            var actual = (new Exam2()).question1(score1, score2, score3);
            var expected = solution(score1, score2, score3);

            assertEquals(actual, expected);
        }
    }
}

says

Error: Something went wrong while discovering the project.

Caused by:
    Expected exactly one package name, found 0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant