Giter VIP home page Giter VIP logo

Comments (4)

kailyak avatar kailyak commented on August 16, 2024

Hi @AshaBPatil, I'm not able to reproduce this with the current version of the framework running springboot 3.2 as the dgs application boots successfully. I noticed error message mentions testClass = com.chegg.acds.answer.service.datafetcher.AnswerFieldDataFetcherTest, it appears this is failing in a test context?

from dgs-framework.

AshaBPatil avatar AshaBPatil commented on August 16, 2024

yes this is happening only in the test environment , this is the test code :
@ExtendWith(MockitoExtension.class)
@SpringBootTest(
classes = {
DgsAutoConfiguration.class,
AnswerFieldDataFetcher.class,
GraphQLRuntimeWiring.class,
DgsExtendedScalarsAutoConfiguration.class
},
properties = {})
public class AnswerFieldDataFetcherTest {
@Autowired DgsQueryExecutor dgsQueryExecutor;
@MockBean AnswerService answerService;
@MockBean Executor answerAsyncExecutor;
HttpHeaders httpHeaders;
@MockBean CompletableFuture completableFuture;

@beforeeach
public void init() {
openMocks(this);
httpHeaders =
new HttpHeaders(
new LinkedMultiValueMap<>() {
{
put(X_CHEGG_USER_UUID.getKey(), Collections.singletonList(USER_UUID.toString()));
}
});
}

@test
@DisplayName("Get ec answer field for question with exception")
public void testEcAnswersWithException() throws ExecutionException, InterruptedException {
doThrow(new RuntimeException()).when(answerAsyncExecutor).execute(any(Runnable.class));

Map<String, Object> variables = getVariables(QUESTION_UUID.toString());
ExecutionResult result =
    dgsQueryExecutor.execute(GET_EC_ANSWER_FIELD_QUERY, variables, null, httpHeaders);
assertTrue(result.getErrors().size() > 0);
assertEquals(
    result.getErrors().get(0).getMessage(),
    String.format(
        "%s: %s",
        InternalServerError.class.getCanonicalName(),
        String.format(UNABLE_TO_GET_EC_ANSWER_BY_QUESTION, QUESTION_UUID)));

}
}

from dgs-framework.

kailyak avatar kailyak commented on August 16, 2024

Confirming this did compile and run in spring 2.x and no longer in 3.x. The issue is that ScheduledExecutorService is a dependency of dgsQueryExecutor and the issue arises when mocking it's superclass Executor.
ScheduledExecutorService extends Executor with additional functionality. Can you try swapping Executor for ScheduledExecutorService for your mock?

from dgs-framework.

AshaBPatil avatar AshaBPatil commented on August 16, 2024

this worked for me thank you

from dgs-framework.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.