小编Erg*_*lat的帖子

将JUnit结果打印到文件

我想将JUnit测试的结果打印到.txt文件中。

以下是我的代码:

try {
    //Creates html header 
    String breaks = "<html><center><p><h2>"+"Test Started on: "+df.format(date)+"</h2></p></center>";

    //Creating two files for passing and failing a test
    File pass = new File("Result_Passed-"+df.format(date)+ ".HTML");
    File failed = new File("Result_Failed-"+df.format(date)+ ".HTML");
    OutputStream fstreamF = new FileOutputStream(failed, true);
    OutputStream fstream = new FileOutputStream(pass, true);
    PrintStream p = new PrintStream(fstream);
    PrintStream  f= new PrintStream(fstreamF);

    //appending the html code to the two files
    p.append(breaks);
    f.append(breaks);

    } catch (FileNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } …
Run Code Online (Sandbox Code Playgroud)

java junit junit4

5
推荐指数
1
解决办法
7084
查看次数

在 Typescript 中使用地图

我在使用maps int Typescript 时遇到了一些麻烦。我想做的是使用与 Java 中类似的 HashMap,例如这里是我的 Java 对象,

public class Payment {
    private String id;
    private DateTime created;

    //when they actually received the payment
    private DateTime paidDate;
    private String customerId;
    private String companyId;
    private BigDecimal amount;
    private BigDecimal allocated;
    private String description;

    // it must be the Id of PaymentMethod
    private String type;

    //to improve it
    private String currency;

    private Boolean fullPaid = false;
    private Boolean lockArchive = false;

    //<InvoiceId, Amount>
    private HashMap<String, BigDecimal> invoices = new HashMap<>();

    //getter …
Run Code Online (Sandbox Code Playgroud)

javascript java typescript angular

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

标签 统计

java ×2

angular ×1

javascript ×1

junit ×1

junit4 ×1

typescript ×1