Package intellijcoder.model.ProblemMaker

Examples of intellijcoder.model.ProblemMaker.Problem


        Maker<Problem> defaultProblem = a(Problem,
                with(className, "BinaryCode"), with(methodName, "decode"), with(returnType, "String[]"),
                with(paramTypes, new String[]{"String"}), with(paramNames, new String[]{"message"}),
                with(testCases, new TestCase[] { make(defaultTestCase) }));

        Problem problem = make(defaultProblem);
        Problem problemCopy = make(defaultProblem);
        Problem problemWithDifferentClassName = make(defaultProblem.but(with(className, "Lottery")));
        Problem problemWithDifferentReturnType = make(defaultProblem.but(with(returnType, "float")));
        Problem problemWithDifferentMethodName = make(defaultProblem.but(with(methodName, "calculate")));
        Problem problemWithDifferentParamType = make(defaultProblem.but(with(paramTypes, new String[]{"int"})));
        Problem problemWithDifferentParamName = make(defaultProblem.but(with(paramNames, new String[]{"m"})));
        Problem problemWithDifferentTestCase = make(defaultProblem.but(
                with(testCases, new TestCase[] { make(defaultTestCase.but(with(output, "2"))) })));

        assertTrue("problems with the same fields should be equal", problem.equals(problemCopy));
        assertTrue("hash codes of problems with the same fields should be equal", problem.hashCode() == problemCopy.hashCode());
        assertFalse("problems with different class names should not be equal", problem.equals(problemWithDifferentClassName));
View Full Code Here


    private CodeBuilder testBuilder = context.mock(CodeBuilder.class, "test");
    IdeWorkspaceManager workspaceManager = new IdeWorkspaceManager(ide, solutionBuilder, testBuilder);

    @Test
    public void projectModuleNamedAfterProblemClassName() throws Exception {
        final Problem problem = make(a(Problem, with(className, "Lottery")));
        context.checking(new Expectations(){{
            oneOf(ide).createModule(with(equal("Lottery")), with(any(String.class)), with(any(String.class)));
            ignoring(solutionBuilder);
            ignoring(testBuilder);
        }});
View Full Code Here

    }


    @Test
    public void getsSolutionSourceFromIde() throws Exception {
        final Problem problem = make(a(Problem));
        context.checking(new Expectations(){{
            atLeast(1).of(ide).getClassSource("Lottery");
            ignoring(ide).createModule(with(any(String.class)), with(any(String.class)), with(any(String.class)));
            ignoring(solutionBuilder);
            ignoring(testBuilder);
View Full Code Here

        workspaceManager.getSolutionSource("Lottery");
    }

    @Test
    public void usesCodeBuilderToGetSolutionClassTemplate() throws Exception {
        final Problem problem = make(a(Problem));
        context.checking(new Expectations(){{
            allowing(solutionBuilder).build(problem); will(returnValue("class template"));
            oneOf(ide).createModule(with(any(String.class)), with(equal("class template")), with(any(String.class)));
            ignoring(testBuilder);
        }});
View Full Code Here

        workspaceManager.createProblemWorkspace(problem);
    }

    @Test
    public void usesCodeBuilderToGetTestClassTemplate() throws Exception {
        final Problem problem = make(a(Problem));
        context.checking(new Expectations(){{
            allowing(testBuilder).build(problem); will(returnValue("test class template"));
            oneOf(ide).createModule(with(any(String.class)), with(any(String.class)), with(equal("test class template")));
            ignoring(solutionBuilder);
        }});
View Full Code Here

TOP

Related Classes of intellijcoder.model.ProblemMaker.Problem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.