久久久久久久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 在測試時間失敗的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我對 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]);
                  }
                  

                  我的測試:在運行時我設(shè)置一個斷點并在 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中設(shè)置一個java.util.Locale.

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

                  如果不設(shè)置,格式化程序?qū)⑹褂?JVM 默認語言環(huán)境.而且如果不是英文,可能會報錯(而且不同的環(huán)境可能有不同的配置,所以最好設(shè)置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).

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

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

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

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

                  相關(guān)文檔推薦

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

                            主站蜘蛛池模板: 国产精品免费小视频 | 欧美一区免费 | 91精品在线看 | 7777在线 | 一区二区三区四区免费视频 | 国产中文字幕在线 | 91精品国产综合久久婷婷香蕉 | 中文字幕在线观 | 日本精品视频一区二区三区四区 | 精品美女久久久 | 一区二区三区视频在线免费观看 | 欧美成人免费在线视频 | 最新91在线 | 中文在线观看视频 | 精品美女在线观看视频在线观看 | 成人在线视频网站 | av一区二区在线观看 | 天天爽网站 | 亚洲午夜精品视频 | 色婷婷一区二区三区四区 | 国产精品日韩欧美一区二区三区 | 久久综合伊人 | 337p日本欧洲亚洲大胆 | 国产一区在线免费 | 五月婷婷视频 | 亚洲一区二区在线 | 97人澡人人添人人爽欧美 | 91精品午夜窝窝看片 | 91欧美精品| 一区二区三区不卡视频 | xxxxxx国产 | 亚洲第一视频 | 91资源在线 | 欧美在线一区视频 | 欧美一区二区大片 | 羞羞色视频 | 国产精品久久久久久一区二区三区 | 亚洲国产精品一区二区第一页 | 免费午夜电影 | 一二区视频 | 国产在线区|