src/test/java/edu/kea/kab/integrationtests/CompareToAverageTest.java
@Test
    void correctCalculation() throws Exception {

        MockHttpSession session = new MockHttpSession();
        String stringSessionId = session.getId();

        mvc.perform(post("/input").with(csrf().asHeader())
                .contentType(MediaType.APPLICATION_FORM_URLENCODED_VALUE)
                .param("videoHours", "10")
                .param("musicHours", "10")
                .param("mobileHours", "10")
                .param("session", stringSessionId)
                .accept(MediaType.APPLICATION_JSON))
                .andDo(print())
                .andExpect(status().isFound());

        // TODO implement the rest of calculation check


    }
// Test if the right percentage is calculated with a given entry
Test if the right percentage is calculated with a given entry
Test if the right percentage is calculated with a given entry
@Test
    void correctCalculation() throws Exception {
        MockHttpSession session = new MockHttpSession();
        String stringSessionId = session.getId();
        mvc.perform(post("/input").with(csrf().asHeader())
                .contentType(MediaType.APPLICATION_FORM_URLENCODED_VALUE)
                .param("videoHours", "10")
                .param("musicHours", "10")
                .param("mobileHours", "10")
                .param("session", stringSessionId)
                .accept(MediaType.APPLICATION_JSON))
                .andDo(print())
                .andExpect(status().isFound());
    }
@ Test void correctCalculation ( ) throws Exception { MockHttpSession session = new MockHttpSession ( ) ; String stringSessionId = session . getId ( ) ; mvc . perform ( post ( "/input" ) . with ( csrf ( ) . asHeader ( ) ) . contentType ( MediaType . APPLICATION_FORM_URLENCODED_VALUE ) . param ( "videoHours" , "10" ) . param ( "musicHours" , "10" ) . param ( "mobileHours" , "10" ) . param ( "session" , stringSessionId ) . accept ( MediaType . APPLICATION_JSON ) ) . andDo ( print ( ) ) . andExpect ( status ( ) . isFound ( ) ) ; }
Test if the right percentage is calculated with a given entry
Test if the right percentage is calculated with a given entry
// TODO implement the rest of calculation check