小编gon*_*ard的帖子

故障安全测试导致声纳

我刚刚分开了单元测试和集成测试.我想将覆盖结果与UT和IT分开.

我按照本教程进行操作(感谢@JohnDobie).

声纳覆盖测试结果

声纳显示单独的代码覆盖率结果和单元测试成功(右上角).但是如何才能在声纳中获得集成测试的成功?

java maven sonarqube

15
推荐指数
1
解决办法
6186
查看次数

React 16:componentDidUpdate警告:计划级联更新

通过Ben Schwarz的这篇文章使用react redux来描述我的应用程序的性能 .

在用户计时部分,我收到这些警告(没有输入标志):

在此输入图像描述

有两条消息:

  • (Committing Changes) Warning: Lifecycle hook scheduled a cascading update
  • Connect(MyComponent).componentDidUpdate Warning: Scheduled a cascading update

我做了一些搜索,但我发现没什么特别的.它似乎与componentDidUpdatereact-redux的连接HOC 的功能有关.

这些消息意味着什么?

performance google-chrome-devtools reactjs redux react-redux

13
推荐指数
1
解决办法
2388
查看次数

包含包裹标签的对照皮肤的优选高度

我写了一个基本的控件和它的皮肤.A label显示在HBox皮肤中.如果空间不足,此标签应包装其文本.

public class LabelWrap extends Application {

    public static void main(String[] args) {
        launch(LabelWrap.class);
    }

    @Override
    public void start(Stage stage) throws Exception {
        BasicControl basicControl = new BasicControl();
        BorderPane borderPane = new BorderPane();
        borderPane.setPrefWidth(150);
        borderPane.setCenter(basicControl);

        stage.setScene(new Scene(borderPane));
        stage.centerOnScreen();
        stage.show();
    }

    private static class BasicControl extends Control {
        @Override
        protected Skin<?> createDefaultSkin() {
            return new BasicControlSkin(this);
        }
    }

    private static class BasicControlSkin extends SkinBase<BasicControl> {
        protected BasicControlSkin(BasicControl control) {
            super(control);
            VBox box = new VBox();
            Label label …
Run Code Online (Sandbox Code Playgroud)

java label javafx word-wrap javafx-8

11
推荐指数
1
解决办法
513
查看次数

在量角器测试中从localStorage中删除一个项目

我试图从量角器测试中删除localStorage中的条目

describe('The feature', function() {

  beforeEach(function() {
    browser.executeScript('localStorage.removeItem("key");');
  });

  it('should do this', function() {

  });
});
Run Code Online (Sandbox Code Playgroud)

但是当测试在chrome中运行时,我收到此错误

UnknownError: <unknown>: Access to 'localStorage' is denied for this document. Storage is disabled inside 'data:' URLs.
  (Session info: chrome=32.0.1700.77)
  (Driver info: chromedriver=2.8.241036,platform=Mac OS X 10.9.0 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 436 milliseconds
Build info: version: '2.39.0', revision: 'ff23eac', time: '2013-12-16 16:11:15'
System info: host: 'MyPC.local', ip: '192.168.1.1', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: …
Run Code Online (Sandbox Code Playgroud)

selenium selenium-chromedriver angularjs selenium-webdriver protractor

8
推荐指数
1
解决办法
8895
查看次数

java for循环中的分支预测

我在if条件旁边看到了这条评论:

// branch prediction favors most often used condition

JavaFX SkinBase类的源代码中.

protected double computeMinWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) {

    double minX = 0;
    double maxX = 0;
    boolean firstManagedChild = true;
    for (int i = 0; i < children.size(); i++) {
        Node node = children.get(i);
        if (node.isManaged()) {
            final double x = node.getLayoutBounds().getMinX() + node.getLayoutX();
            if (!firstManagedChild) {  // branch prediction favors most often used condition
                minX = Math.min(minX, x);
                maxX …
Run Code Online (Sandbox Code Playgroud)

java javafx java-8 branch-prediction

8
推荐指数
1
解决办法
978
查看次数

移动applet而不重新加载它

我想将applet从div元素移动到另一个div元素而不重新加载它.我不想使用绝对定位.有没有办法做到这一点 ?

我试试这个,但它不起作用:

<html>
    <head>
    <script type="text/javascript">
        function toDiv1() {
            var appletElt = document.getElementById('myApplet');
            document.getElementById('div1').appendChild(appletElt);
        }

        function toDiv2() {
            var appletElt = document.getElementById('myApplet');
            document.getElementById('div2').appendChild(appletElt);
        }
    </script>
    </head>
    <body>
        <div id ="myApplet">
            <applet width="200" height="200" 
                codebase="http://mainline.brynmawr.edu/Courses/cs110/spring2002/Applets/Smiley/"
                code="Smiley.class"
                name="Smiley">
            </applet>
        </div>
        <div id="div1"></div>
        <div id="div2"></div>
        <div>
            <button onclick="toDiv1()">toDiv1</button>
            <button onclick="toDiv2()">toDiv2</button>
        </div>
    </body>
</html>
Run Code Online (Sandbox Code Playgroud)

你可以试试这个小提琴


@goldenparrot提出的解决方案outerHTML有效但不适用于所有浏览器(至少是Firefox ESR).

正如@kritzikratzi答案和@biziclop答案中所述,firefox上存在已知问题,重新加载iframe,flash对象,firefox中的插件.

我认为(但我不确定)唯一的解决方案是使用绝对定位(@cuzzea).但是,我问这个问题是因为我想找到另一种方式("我不想使用绝对定位").这就是我不会给出答案的原因.

谢谢你的贡献.

html javascript java applet

7
推荐指数
1
解决办法
888
查看次数

如何生成构建器类

我在库中开发了一个自定义的javafx.animation.Transition.我想提供相应的制造商(如TranslateBuilder用于Translate转换).

正如您在TranslateBuilder javadoc中看到的那样,构建器类由注释@Generated(value="Generated by javafx.builder.processor.BuilderProcessor").

可以使用这个处理器吗?如果有,怎么样?

java javafx-2

7
推荐指数
1
解决办法
211
查看次数

如何在javafx栏上显示条形值

从这个代码我可以生成10条现在的条形图现在我想知道如何在条形图上显示每个条形的值,如附加图像:在此输入图像描述

这是代码:

public class BarChartSample extends Application {


    @Override public void start(Stage stage) {
        stage.setTitle("Bar Chart Sample");
        final CategoryAxis xAxis = new CategoryAxis();
        final NumberAxis yAxis = new NumberAxis();
        final BarChart<String,Number> bc = 
            new BarChart<String,Number>(xAxis,yAxis);
        bc.setTitle("Country Summary");
        xAxis.setLabel("bars");       
        yAxis.setLabel("Value");

        XYChart.Series series1 = new XYChart.Series();
        series1.setName("...");       

for(int i=0;i<10;i++)
{
   //here i want to change color of bar if value of i is >5 than red if i>8 than blue 
series1.getData().add(new XYChart.Data("Value", i));

}          

}

public static void main(String[] args) {
        launch(args); …
Run Code Online (Sandbox Code Playgroud)

java bar-chart javafx-2

7
推荐指数
1
解决办法
1万
查看次数

Sonar Pitest插件

我想整合一些突变测试,以确保我的junit测试的质量.我希望将结果放在我项目的声纳仪表板中.

声纳pitest插件似乎做我想做的,但也有一些问题与Maven 3,它仍然是正在开发中.

有没有人试过这个插件?还有其他选择吗?

mutation-testing maven-3 pitest sonarqube

6
推荐指数
1
解决办法
1976
查看次数

java如何从内部内部类实现对封闭类的访问?

我在内部类中创建了一个内部类:

public class EnclosingClass {

    public class InnerClass {
        private EnclosingClass getEnclosing() {
            return EnclosingClass.this;
        }

        public class InnerInnerClass {
            private InnerClass getEnclosing() {
                return InnerClass.this;
            }

            private EnclosingClass getEnclosingOfEnclosing() {
                return EnclosingClass.this;
            }
        }        
    }
}
Run Code Online (Sandbox Code Playgroud)

我很惊讶java允许InnerInnerClass直接访问EnclosingClass.这个代码是如何在Java内部实现的?

InnerInnerClass保持两个指针(一个在InnerClass和其他的EnclosingClass)或InnerInnerClass访问EnclosingClassInnerClass

java

6
推荐指数
1
解决办法
207
查看次数