Skip to content

Commit

Permalink
Move tests requiring isNewUI call from unit tests to integration tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomasz Pasternak committed May 31, 2024
1 parent 8c31c28 commit 513823b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import com.google.idea.blaze.base.BlazeTestCase;
import com.google.idea.blaze.base.BlazeIntegrationTestCase;
import com.google.idea.blaze.base.command.BlazeCommandName;
import com.google.idea.blaze.base.settings.Blaze;
import com.google.idea.blaze.base.settings.BlazeImportSettings;
Expand All @@ -30,28 +30,28 @@
import org.jdom.Element;
import org.jdom.output.Format;
import org.jdom.output.XMLOutputter;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/** Tests for {@link BlazeCommandRunConfigurationCommonState}. */
@RunWith(JUnit4.class)
public class BlazeCommandRunConfigurationCommonStateTest extends BlazeTestCase {
public class BlazeCommandRunConfigurationCommonStateTest extends BlazeIntegrationTestCase {
private static final BlazeImportSettings DUMMY_IMPORT_SETTINGS =
new BlazeImportSettings("", "", "", "", BuildSystemName.Blaze, ProjectType.ASPECT_SYNC);
private static final BlazeCommandName COMMAND = BlazeCommandName.fromString("command");

private BlazeCommandRunConfigurationCommonState state;

@Override
protected void initTest(Container applicationServices, Container projectServices) {
super.initTest(applicationServices, projectServices);
@Before
public void init() throws Throwable {
super.setUp();

projectServices.register(
BlazeImportSettingsManager.class, new BlazeImportSettingsManager(project));
registerProjectService(BlazeImportSettingsManager.class, new BlazeImportSettingsManager(getProject()));
BlazeImportSettingsManager.getInstance(getProject()).setImportSettings(DUMMY_IMPORT_SETTINGS);

state = new BlazeCommandRunConfigurationCommonState(Blaze.getBuildSystemName(project));
state = new BlazeCommandRunConfigurationCommonState(Blaze.getBuildSystemName(getProject()));
}

@Test
Expand All @@ -65,7 +65,7 @@ public void readAndWriteShouldMatch() throws Exception {
Element element = new Element("test");
state.writeExternal(element);
BlazeCommandRunConfigurationCommonState readState =
new BlazeCommandRunConfigurationCommonState(Blaze.getBuildSystemName(project));
new BlazeCommandRunConfigurationCommonState(Blaze.getBuildSystemName(getProject()));
readState.readExternal(element);

assertThat(readState.getCommandState().getCommand()).isEqualTo(COMMAND);
Expand All @@ -82,7 +82,7 @@ public void readAndWriteShouldHandleNulls() throws Exception {
Element element = new Element("test");
state.writeExternal(element);
BlazeCommandRunConfigurationCommonState readState =
new BlazeCommandRunConfigurationCommonState(Blaze.getBuildSystemName(project));
new BlazeCommandRunConfigurationCommonState(Blaze.getBuildSystemName(getProject()));
readState.readExternal(element);

assertThat(readState.getCommandState().getCommand())
Expand All @@ -109,7 +109,7 @@ public void readShouldOmitEmptyFlags() throws Exception {
Element element = new Element("test");
state.writeExternal(element);
BlazeCommandRunConfigurationCommonState readState =
new BlazeCommandRunConfigurationCommonState(Blaze.getBuildSystemName(project));
new BlazeCommandRunConfigurationCommonState(Blaze.getBuildSystemName(getProject()));
readState.readExternal(element);

assertThat(readState.getBlazeFlagsState().getRawFlags())
Expand Down Expand Up @@ -140,7 +140,7 @@ public void repeatedWriteShouldNotChangeElement() throws Exception {

@Test
public void editorApplyToAndResetFromShouldMatch() throws Exception {
RunConfigurationStateEditor editor = state.getEditor(project);
RunConfigurationStateEditor editor = state.getEditor(getProject());

state.getCommandState().setCommand(COMMAND);
state.getBlazeFlagsState().setRawFlags(ImmutableList.of("--flag1", "--flag2"));
Expand All @@ -149,7 +149,7 @@ public void editorApplyToAndResetFromShouldMatch() throws Exception {

editor.resetEditorFrom(state);
BlazeCommandRunConfigurationCommonState readState =
new BlazeCommandRunConfigurationCommonState(Blaze.getBuildSystemName(project));
new BlazeCommandRunConfigurationCommonState(Blaze.getBuildSystemName(getProject()));
editor.applyEditorTo(readState);

assertThat(readState.getCommandState().getCommand())
Expand All @@ -166,11 +166,11 @@ public void editorApplyToAndResetFromShouldMatch() throws Exception {

@Test
public void editorApplyToAndResetFromShouldHandleNulls() throws Exception {
RunConfigurationStateEditor editor = state.getEditor(project);
RunConfigurationStateEditor editor = state.getEditor(getProject());

editor.resetEditorFrom(state);
BlazeCommandRunConfigurationCommonState readState =
new BlazeCommandRunConfigurationCommonState(Blaze.getBuildSystemName(project));
new BlazeCommandRunConfigurationCommonState(Blaze.getBuildSystemName(getProject()));
editor.applyEditorTo(readState);

assertThat(readState.getCommandState().getCommand())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@

import static com.google.common.truth.Truth.assertThat;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.idea.blaze.base.BlazeTestCase;
import com.google.idea.blaze.base.BlazeIntegrationTestCase;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
Expand All @@ -14,7 +13,7 @@

/** Unit tests for {@link EnvironmentVariablesState}. */
@RunWith(JUnit4.class)
public class EnvironmentVariablesStateTest extends BlazeTestCase {
public class EnvironmentVariablesStateTest extends BlazeIntegrationTestCase {

@Test
public void testSetEnvVarsReadWrite() {
Expand Down

0 comments on commit 513823b

Please sign in to comment.