久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <legend id='cwRJy'><style id='cwRJy'><dir id='cwRJy'><q id='cwRJy'></q></dir></style></legend>

    <small id='cwRJy'></small><noframes id='cwRJy'>

    <i id='cwRJy'><tr id='cwRJy'><dt id='cwRJy'><q id='cwRJy'><span id='cwRJy'><b id='cwRJy'><form id='cwRJy'><ins id='cwRJy'></ins><ul id='cwRJy'></ul><sub id='cwRJy'></sub></form><legend id='cwRJy'></legend><bdo id='cwRJy'><pre id='cwRJy'><center id='cwRJy'></center></pre></bdo></b><th id='cwRJy'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='cwRJy'><tfoot id='cwRJy'></tfoot><dl id='cwRJy'><fieldset id='cwRJy'></fieldset></dl></div>
      <bdo id='cwRJy'></bdo><ul id='cwRJy'></ul>
    1. <tfoot id='cwRJy'></tfoot>

      1. java DateTimeFormatterBuilder 在測試時間失敗

        java DateTimeFormatterBuilder fails on testtime(java DateTimeFormatterBuilder 在測試時間失敗)

          1. <i id='eZGUN'><tr id='eZGUN'><dt id='eZGUN'><q id='eZGUN'><span id='eZGUN'><b id='eZGUN'><form id='eZGUN'><ins id='eZGUN'></ins><ul id='eZGUN'></ul><sub id='eZGUN'></sub></form><legend id='eZGUN'></legend><bdo id='eZGUN'><pre id='eZGUN'><center id='eZGUN'></center></pre></bdo></b><th id='eZGUN'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='eZGUN'><tfoot id='eZGUN'></tfoot><dl id='eZGUN'><fieldset id='eZGUN'></fieldset></dl></div>
            • <tfoot id='eZGUN'></tfoot><legend id='eZGUN'><style id='eZGUN'><dir id='eZGUN'><q id='eZGUN'></q></dir></style></legend>
                  <bdo id='eZGUN'></bdo><ul id='eZGUN'></ul>

                  <small id='eZGUN'></small><noframes id='eZGUN'>

                    <tbody id='eZGUN'></tbody>

                  本文介紹了java DateTimeFormatterBuilder 在測試時間失敗的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我對 DateTimeFormatterBuilder 有一個簡單的 jUnit 測試.在運行時,當 Spring-MVC 處理程序 (@RequestParam)

                  I have a simple jUnit test for DateTimeFormatterBuilder. At runtime it works, when some String comes on Spring-MVC hanlder (@RequestParam)

                  在測試時它以相同的 String 值失敗.

                  At testtime it fails with the same String value.

                  測試值:25-May-2018 11:10

                  待測方法:

                  public void getTimeDifference(@RequestParam String startDate, @RequestParam String endDate) {
                      DateTimeFormatter DATE_TIME_FORMAT = new DateTimeFormatterBuilder().parseCaseInsensitive().appendPattern("dd-MMM-yyyy HH:mm").toFormatter();
                      LocalDateTime.parse(startDate,DATE_TIME_FORMAT);
                      return   messages;
                  }
                  

                  測試方法:

                  @Test
                  public void testFormat() throws Exception {
                      final String startDateFormatA = "25-May-2018 11:10";
                      final String endDateFormatA = "25-May-2018 11:10";
                      assertEquals("06:00", callDbController.getTimeDifference(startDateFormatA, endDateFormatA)[1]);
                  }
                  

                  我的測試:在運行時我設置一個斷點并在 Display-View 上測試它:

                  My Test: At runtime I set a break-point and test it on Display-View:

                  LocalDateTime.parse("25-May-2018 11:10",DATE_TIME_FORMAT)
                  

                  在測試時使用相同的 spring-aplication-context 我在運行時做同樣的事情,但它失敗了.

                  At testtime with the same spring-aplication-context I do the same like on runtime and it fails.

                  有人有想法嗎?

                  推薦答案

                  月份名稱是英文的,所以你最好在formatter中設置一個java.util.Locale.

                  The month name is in English, so you'd better set a java.util.Locale in the formatter.

                  如果不設置,格式化程序將使用 JVM 默認語言環境.而且如果不是英文,可能會報錯(而且不同的環境可能有不同的配置,所以最好設置locale而不是依賴JVM的默認值).

                  If you don't set it, the formatter will use the JVM default locale. And if it's not English, you might get an error (and different environments might have different configurations, so it's better to set the locale instead of relying on the JVM's default).

                  只需執行 toFormatter(Locale.ENGLISH) 而不是 toFormatter() 即可.

                  Just do toFormatter(Locale.ENGLISH) instead of just toFormatter() and that's it.

                  這篇關于java DateTimeFormatterBuilder 在測試時間失敗的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How can I detect integer overflow on 32 bits int?(如何檢測 32 位 int 上的整數溢出?)
                  Local variables before return statements, does it matter?(return 語句之前的局部變量,這有關系嗎?)
                  How to convert Integer to int?(如何將整數轉換為整數?)
                  How do I create an int array with randomly shuffled numbers in a given range(如何在給定范圍內創建一個隨機打亂數字的 int 數組)
                  Inconsistent behavior on java#39;s ==(java的行為不一致==)
                  Why is Java able to store 0xff000000 as an int?(為什么 Java 能夠將 0xff000000 存儲為 int?)

                • <tfoot id='dGluM'></tfoot>

                  1. <small id='dGluM'></small><noframes id='dGluM'>

                      <bdo id='dGluM'></bdo><ul id='dGluM'></ul>
                    • <i id='dGluM'><tr id='dGluM'><dt id='dGluM'><q id='dGluM'><span id='dGluM'><b id='dGluM'><form id='dGluM'><ins id='dGluM'></ins><ul id='dGluM'></ul><sub id='dGluM'></sub></form><legend id='dGluM'></legend><bdo id='dGluM'><pre id='dGluM'><center id='dGluM'></center></pre></bdo></b><th id='dGluM'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='dGluM'><tfoot id='dGluM'></tfoot><dl id='dGluM'><fieldset id='dGluM'></fieldset></dl></div>
                      <legend id='dGluM'><style id='dGluM'><dir id='dGluM'><q id='dGluM'></q></dir></style></legend>
                          <tbody id='dGluM'></tbody>

                            主站蜘蛛池模板: 欧美一区二区三区久久精品 | 久久av一区二区三区 | 中文字幕在线第二页 | 久久久久久亚洲国产精品 | 国产成人福利在线 | 久久激情网| 一级亚洲| 青青草原综合久久大伊人精品 | 一级黄色绿像片 | 瑟瑟激情 | 亚洲不卡在线观看 | 久久国产精品视频 | 国产精品亚洲精品 | 亚洲欧美日韩高清 | 国产一区 | 九七午夜剧场福利写真 | 超碰综合 | 久久国产电影 | 在线高清免费观看视频 | 国产日韩欧美一区 | 国产免费又黄又爽又刺激蜜月al | 中文字幕一区二区三区四区五区 | 国产日韩欧美一区 | 欧美精品 在线观看 | 日韩欧美一区二区在线播放 | 国产aa | 91在线视频免费观看 | 久久久久久国产精品mv | 欧美日韩精品一区二区 | 亚洲视频免费在线看 | 国产欧美日韩一区 | 56pao在线 | 56pao在线 | 99热碰 | 国产成人精品一区 | 狠狠操婷婷| 欧美精品在欧美一区二区 | 精品视频国产 | 日韩av一区二区在线观看 | 日韩av成人 | 日韩中文字幕区 |