Api resolver test

Kyle_Kim·2022년 9월 15일
0

KSMART

목록 보기
2/3

    @Test
    void aoiJobDeploy() throws Exception{
        String createQuery =
         "   mutation DeployAoiJob( $aoiJobLibParam : AoiJobLibParam!){ \n"+
            "aoiJobDeploy(aoijobLibraryParam : $aoiJobLibParam)\n"+
        "}";

        AoiJobLibParam param = AoiJobLibParam.DeployParameterBuilder()
            .jobIds(Arrays.asList( 235L))
            .fromAsstSeqnos(1092L)
            .targetAsstSeqnos(Arrays.asList( 1296L))
            .olpType("")
            .copyInspYn("")
            .deployIdx(Arrays.asList())
            .adminSeqno(10214L)
            .build();
        Mockito.when(aoiJobLibraryService.jobCopySave(eq(param) , any() , any() )).thenReturn("OK");

        GraphQLResponse response = graphQLTestTemplate
            .withClearHeaders()
            .postMultipart(createQuery ,
                "{\n" +
                    "\"aoiJobLibParam\": {\n"+
                    "\"jobIds\": [235], \n"+
                    "\"fromAsstSeqnos\": 1092,\n" +
                    "\"targetAsstSeqnos\": [1296],\n" +
                    "\"olpType\": \"\" ,\n" +
                    "\"copyInspYn\": \"\",\n"+
                    "\"adminSeqno\": 10214\n" +
                    "}\n"+
                    "}\n"
            ).assertThatNoErrorsArePresent();

        assertTrue(response.isOk());
        Mockito.verify(aoiJobLibraryService , Mockito.times(1) ).jobCopySave(eq(param) ,any() ,any());

    }
  @Test
    void aoiJobDeploy() throws Exception{
        String createQuery =
         "   mutation DeployAoiJob( $aoiJobLibParam : AoiJobLibParam!){ \n"+
            "aoiJobDeploy(aoijobLibraryParam : $aoiJobLibParam)\n"+
        "}";

        AoiJobLibParam param = AoiJobLibParam.DeployParameterBuilder()
            .jobIds(Arrays.asList( 235L))
            .fromAsstSeqnos(1092L)
            .targetAsstSeqnos(Arrays.asList( 1296L))
            .olpType("")
            .copyInspYn("")
            .deployIdx(Arrays.asList())
            .adminSeqno(10214L)
            .build();
        Mockito.when(aoiJobLibraryService.jobCopySave(any() , any() , any() )).thenReturn("OK");

        GraphQLResponse response = graphQLTestTemplate
            .withClearHeaders()
            .postMultipart(createQuery ,
                "{\n" +
                    "\"aoiJobLibParam\": {\n"+
                    "\"jobIds\": [235], \n"+
                    "\"fromAsstSeqnos\": 1092,\n" +
                    "\"targetAsstSeqnos\": [1296],\n" +
                    "\"olpType\": \"\" ,\n" +
                    "\"copyInspYn\": \"\",\n"+
                    "\"adminSeqno\": 10214\n" +
                    "}\n"+
                    "}\n"
            ).assertThatNoErrorsArePresent();

        assertTrue(response.isOk());
        Mockito.verify(aoiJobLibraryService , Mockito.times(1) ).jobCopySave(any() ,any() ,any());

    }```
profile
꾸준함.

0개의 댓글