View Javadoc

1   package com.atlassian.asap.nimbus.parser;
2   
3   import net.minidev.json.parser.JSONParser;
4   import net.minidev.json.parser.ParseException;
5   import org.openjdk.jmh.annotations.Benchmark;
6   import org.openjdk.jmh.annotations.Scope;
7   import org.openjdk.jmh.annotations.State;
8   
9   public class NimbusJsr353TranslatorBenchmark {
10      @Benchmark
11      public void nimbusToJsr353(BenchmarkState state) throws ParseException {
12          NimbusJsr353Translator.nimbusToJsr353(state.originalNimbus);
13      }
14  
15      @State(Scope.Benchmark)
16      public static class BenchmarkState {
17          private Object originalNimbus;
18  
19          public BenchmarkState() {
20              try {
21                  originalNimbus = new JSONParser(JSONParser.MODE_STRICTEST).parse("{\"key\":[42,3.14,\"foobar\",true,false,null,{}]}");
22              } catch (ParseException e) {
23                  throw new RuntimeException(e);
24              }
25          }
26      }
27  }