Skip to content

Commit

Permalink
chore: extract failing test to a QuarkusTest instead QuarkusIntegrati…
Browse files Browse the repository at this point in the history
…onTest
  • Loading branch information
Denis Anisimov committed Sep 9, 2021
1 parent fe2d5bc commit ff800d7
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* Copyright 2000-2021 Vaadin Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.vaadin.flow.quarkus.it;

import java.io.IOException;

import io.quarkus.test.junit.QuarkusIntegrationTest;
import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import com.vaadin.flow.quarkus.it.sessioncontext.SessionContextView;

import static com.vaadin.flow.quarkus.it.sessioncontext.SessionContextView.SessionScopedBean.DESTROY_COUNT;

/**
* This should be a part of SessionContextTest but it seems someone starts Java
* 8 instead of Java 11 to execute this specific test on TC so it's a
* {@link QuarkusTest} instead {@link QuarkusIntegrationTest}.
*/
@QuarkusTest
public class SessionContextCloseTest extends AbstractCdiTest {

@Override
protected String getTestPath() {
return "/session";
}

@BeforeEach
public void setUp() throws Exception {
resetCounts();
open();
}

@Test
public void vaadinSessionCloseDestroysSessionContext() throws Exception {
assertDestroyCountEquals(0);
click(SessionContextView.INVALIDATEBTN_ID);
assertDestroyCountEquals(1);
}

private void assertDestroyCountEquals(int expectedCount)
throws IOException {
assertCountEquals(expectedCount, DESTROY_COUNT);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,6 @@ public void sameSessionIsAccessibleFromUIs() {
assertLabelEquals(SessionContextView.VALUE);
}

@Test
public void vaadinSessionCloseDestroysSessionContext() throws Exception {
assertDestroyCountEquals(0);
click(SessionContextView.INVALIDATEBTN_ID);
assertDestroyCountEquals(1);
}

@Test
public void httpSessionCloseDestroysSessionContext() throws Exception {
assertDestroyCountEquals(0);
Expand Down

0 comments on commit ff800d7

Please sign in to comment.